From 3752ce25d4386b9ec878e12a8e69600c2ab69ba6 Mon Sep 17 00:00:00 2001 From: Matthew Huntington Date: Wed, 22 Nov 2023 11:54:09 -0500 Subject: [PATCH] light green when timer is running but mic threshold not exceeded --- src/components/timer.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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 @@