[chronojump] Encoder rhythm changes auto end encoder capture behaviour
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder rhythm changes auto end encoder capture behaviour
- Date: Wed, 24 Jan 2018 15:49:33 +0000 (UTC)
commit 158f6f743ff9ec40f0c9b080999698d5c3d2f2fa
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Jan 24 16:49:09 2018 +0100
Encoder rhythm changes auto end encoder capture behaviour
glade/repetitive_conditions.glade | 6 +++++-
src/encoderCapture.cs | 23 ++++++++++++++++-------
src/encoderRhythm.cs | 8 ++++++++
src/gui/encoder.cs | 6 ++++--
src/gui/repetitiveConditions.cs | 5 +++++
5 files changed, 38 insertions(+), 10 deletions(-)
---
diff --git a/glade/repetitive_conditions.glade b/glade/repetitive_conditions.glade
index daabd00..e39ae28 100644
--- a/glade/repetitive_conditions.glade
+++ b/glade/repetitive_conditions.glade
@@ -3916,9 +3916,13 @@
</packing>
</child>
<child>
- <widget class="GtkTextView" id="textview1">
+ <widget class="GtkTextView" id="textview_encoder_rhythm_clusters">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
+ <property name="text" translatable="yes">Set will end when user
press Finish or Cancel or
+when there's no change in the encoder during this time:
+1.5 * Rest between clusters</property>
</widget>
<packing>
<property name="expand">True</property>
diff --git a/src/encoderCapture.cs b/src/encoderCapture.cs
index 99a6adc..bd67e8e 100644
--- a/src/encoderCapture.cs
+++ b/src/encoderCapture.cs
@@ -212,7 +212,7 @@ public abstract class EncoderCapture
}
public bool Capture(string outputData1, EncoderRProcCapture encoderRProcCapture,
- bool compujump, Preferences.TriggerTypes cutByTriggers)
+ bool compujump, Preferences.TriggerTypes cutByTriggers, double restClustersSeconds)
{
/*
* removed at 1.7.0
@@ -345,13 +345,22 @@ public abstract class EncoderCapture
//but it has to be moved a little bit first, just to give time to the people
//if(consecutiveZeros >= consecutiveZerosMax && sum > 0) #Not OK because sum
maybe is 0: +1,+1,-1,-1
//if(consecutiveZeros >= consecutiveZerosMax && ecca.ecc.Count > 0) #Not ok
because when ecca is created, ecc.Count == 1
- //
- //process ends
- //when a curve has been found and then there are n seconds of inactivity, or
- //when a curve has not been found and then there are 2*n seconds of inactivity
+ /*
+ * process ends
+ * (
+ * when a curve has been found and then there are n seconds of inactivity, or
+ * when not in cont and a curve has not been found and then there are 2*n
seconds of inactivity
+ * ) and if consecutiveZeros > restClustersSeconds * 1.500
+ *
+ * 1500 is conversion to milliseconds and * 1.5 to have enough time to move
after clusters res
+ */
if(
- (Ecca.curvesAccepted > 0 && consecutiveZeros >=
consecutiveZerosMax) ||
- (! cont && Ecca.curvesAccepted == 0 && consecutiveZeros >=
(2* consecutiveZerosMax)) )
+ (
+ (Ecca.curvesAccepted > 0 && consecutiveZeros >=
consecutiveZerosMax) ||
+ (! cont && Ecca.curvesAccepted == 0 && consecutiveZeros >=
(2* consecutiveZerosMax))
+ ) &&
+ (restClustersSeconds == 0 || consecutiveZeros >
restClustersSeconds * 1500)
+ )
{
finish = true;
LogB.Information("SHOULD FINISH");
diff --git a/src/encoderRhythm.cs b/src/encoderRhythm.cs
index a18a85d..e493e9b 100644
--- a/src/encoderRhythm.cs
+++ b/src/encoderRhythm.cs
@@ -77,6 +77,14 @@ public class EncoderRhythm
return false;
}
+
+ public double RestClustersForEncoderCaptureAutoEnding()
+ {
+ if(Active && UseClusters() && RestClustersSeconds > 0)
+ return RestClustersSeconds;
+
+ return 0;
+ }
}
public class EncoderRhythmExecute
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index ba183e2..3baf1ce 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -2528,7 +2528,8 @@ public partial class ChronoJumpWindow
UtilEncoder.GetEncoderDataTempFileName(),
encoderRProcCapture,
configChronojump.Compujump,
- encoderRProcCapture.CutByTriggers
+ encoderRProcCapture.CutByTriggers,
+ encoderRhythm.RestClustersForEncoderCaptureAutoEnding()
);
//wait to ensure capture thread has ended
@@ -2569,7 +2570,8 @@ public partial class ChronoJumpWindow
UtilEncoder.GetEncoderDataTempFileName(),
encoderRProcCapture,
false, //compujump
- Preferences.TriggerTypes.NO_TRIGGERS
+ Preferences.TriggerTypes.NO_TRIGGERS,
+ 0 //encoderRhythm.RestClustersForEncoderCaptureAutoEnding()
);
//wait to ensure capture thread has ended
diff --git a/src/gui/repetitiveConditions.cs b/src/gui/repetitiveConditions.cs
index 60cb1ba..deb99ab 100644
--- a/src/gui/repetitiveConditions.cs
+++ b/src/gui/repetitiveConditions.cs
@@ -588,7 +588,12 @@ public class RepetitiveConditionsWindow
private void on_button_rhythm_default_clicked (object o, EventArgs args)
{
+ //have default values
EncoderRhythm encoderRhythm = new EncoderRhythm();
+ //But have rhythm active
+ encoderRhythm.Active = true;
+
+ //modify widgets
encoder_rhythm_set_values(encoderRhythm);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]