diff --git a/src/components/timer.vue b/src/components/timer.vue index 8209bf0..226cb03 100644 --- a/src/components/timer.vue +++ b/src/components/timer.vue @@ -40,7 +40,8 @@ analyser:null, secondsToSubtract:0, micThreshold:0, - micLevel:0 + micLevel:0, + micThresholdExceeded:false } }, methods: { @@ -80,8 +81,11 @@ const arraySum = array.reduce((a, value) => a + value, 0); this.micLevel = arraySum / array.length; - if(this.micLevel < this.micThreshold){ + if(this.micLevel > this.micThreshold){ + this.micThresholdExceeded = true; + } else { this.secondsToSubtract++; + this.micThresholdExceeded = false; } this.totalSeconds = getAccumulatedSeconds(Date.now(), this.startTime) - this.secondsToSubtract + this.savedPreviousSeconds; @@ -139,7 +143,7 @@