commit 0ce820b39e8dd4aebe97810f781e353688e7f603
parent 79c5f2d9ced6c8a6879dea7e643d5d769565021d
Author: Adam M <[email protected]>
Date: Sat, 23 Jan 2021 12:03:24 -0600
enums for clock mode
Diffstat:
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/ComputerscareBlank.cpp b/src/ComputerscareBlank.cpp
@@ -80,7 +80,7 @@ struct ComputerscareBlank : ComputerscareMenuParamModule {
bool expanderConnected = false;
- int clockMode = 0;
+ int clockMode = CLOCK_MODE_SYNC;
bool clockConnected = false;
bool resetConnected = false;
bool speedConnected = false;
@@ -99,6 +99,12 @@ struct ComputerscareBlank : ComputerscareMenuParamModule {
float leftMessages[2][10] = {};
+ enum ClockModes {
+ CLOCK_MODE_SYNC,
+ CLOCK_MODE_SCAN,
+ CLOCK_MODE_FRAME
+ };
+
enum ParamIds {
ANIMATION_SPEED,
ANIMATION_ENABLED,
@@ -188,7 +194,7 @@ struct ComputerscareBlank : ComputerscareMenuParamModule {
if (clockConnected) {
bool clockTriggered = clockTrigger.process(messageFromExpander[2]);
- if (clockMode == 0) {
+ if (clockMode == CLOCK_MODE_SYNC) {
//sync
float currentSyncTime = syncTimer.process(args.sampleTime);
if (clockTriggered) {
@@ -200,12 +206,12 @@ struct ComputerscareBlank : ComputerscareMenuParamModule {
}
}
- else if (clockMode == 1) {
+ else if (clockMode == CLOCK_MODE_SCAN) {
//scan
float scanPosition = messageFromExpander[2];
scanToPosition(scanPosition);
}
- else if (clockMode == 2) {
+ else if (clockMode == CLOCK_MODE_FRAME) {
//frame advance
shouldAdvanceAnimation = clockTriggered;
}
@@ -233,8 +239,8 @@ struct ComputerscareBlank : ComputerscareMenuParamModule {
expanderConnected = false;
}
- if (expanderConnected && clockConnected && (clockMode == 2)) {
-
+ if (expanderConnected && clockConnected && (clockMode == CLOCK_MODE_FRAME)) {
+ //no-op for frame mode for some reason?
}
else {
if (sampleCounter > samplesDelay) {
@@ -384,7 +390,7 @@ struct ComputerscareBlank : ComputerscareMenuParamModule {
float appliedSpeedDivisor = 1;
float base = frameDelaySeconds;
- if (expanderConnected && clockConnected && (clockMode == 0)) {
+ if (expanderConnected && clockConnected && (clockMode == CLOCK_MODE_SYNC)) {
appliedSpeedDivisor = speedFactor;
}
else {
diff --git a/src/ComputerscareBlankExpander.cpp b/src/ComputerscareBlankExpander.cpp
@@ -3,7 +3,7 @@
struct ComputerscareBlankExpander;
-const std::string clockModeDescriptions[3] = {"Sync\nAnimation will synchronize to a steady clock signal", "Scan\nAnimation will linearly follow a 0-10v CV. 0v => frame 1, 10v => last frame", "Frame Advance\nClock signal will advance the animation by 1 frame" };
+const std::string clockModeDescriptions[3] = {"Sync\nAnimation will synchronize to a steady clock signal", "Scan\nAnimation will linearly follow a 0-10v CV. 0v → frame 1, 10v → last frame", "Frame Advance\nClock signal will advance the animation by 1 frame" };
struct FrameOffsetParam : ParamQuantity {