[chronojump] Detecting spurious triggers on encoder playSound
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [chronojump] Detecting spurious triggers on encoder playSound
- Date: Thu, 19 Apr 2018 06:57:13 +0000 (UTC)
commit 3eb74046e3d0564130f8d265f357e392ef4f9957
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Apr 19 08:56:37 2018 +0200
    Detecting spurious triggers on encoder playSound
 src/encoderCapture.cs |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/encoderCapture.cs b/src/encoderCapture.cs
index f9b4fee..2523008 100644
--- a/src/encoderCapture.cs
+++ b/src/encoderCapture.cs
@@ -244,6 +244,9 @@ public abstract class EncoderCapture
                //only for cutByTriggers == Preferences.TriggerTypes.START_AT_FIRST_ON
                bool firstTriggerHappened = false;
 
+               //playSoundsFromFile
+               DateTime lastTriggeredSound = DateTime.MinValue;
+
                if(capturingInertialBG)
                {
                        /*
@@ -271,7 +274,13 @@ public abstract class EncoderCapture
                        {
                                if(playSoundsFromFile)
                                {
-                                       Util.NextSongInList();
+                                       TimeSpan ts = DateTime.Now.Subtract(lastTriggeredSound);
+                                       if(ts.TotalMilliseconds > 50)
+                                       {
+                                               Util.NextSongInList();
+                                               lastTriggeredSound = DateTime.Now;
+                                       }
+
                                        continue;
                                }
 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]