Refactor CV Mod #24

Merged
awonak merged 4 commits from refactor-cvmod into main 2025-08-09 23:59:25 +00:00
4 changed files with 108 additions and 138 deletions
Showing only changes of commit d2972ccbe3 - Show all commits

View File

@ -86,26 +86,21 @@ class Channel {
void setClockMod(int index) { void setClockMod(int index) {
base_clock_mod_index = constrain(index, 0, MOD_CHOICE_SIZE - 1); base_clock_mod_index = constrain(index, 0, MOD_CHOICE_SIZE - 1);
_recalculatePulses();
} }
void setProbability(int prob) { void setProbability(int prob) {
base_probability = constrain(prob, 0, 100); base_probability = constrain(prob, 0, 100);
_recalculatePulses();
} }
void setDutyCycle(int duty) { void setDutyCycle(int duty) {
base_duty_cycle = constrain(duty, 1, 99); base_duty_cycle = constrain(duty, 1, 99);
_recalculatePulses();
} }
void setOffset(int off) { void setOffset(int off) {
base_offset = constrain(off, 0, 99); base_offset = constrain(off, 0, 99);
_recalculatePulses();
} }
void setSwing(int val) { void setSwing(int val) {
base_swing = constrain(val, 50, 95); base_swing = constrain(val, 50, 95);
_recalculatePulses();
} }
// Euclidean // Euclidean
@ -189,6 +184,8 @@ class Channel {
return; return;
} }
if (isCvModActive()) _recalculatePulses();
int cv1 = gravity.cv1.Read(); int cv1 = gravity.cv1.Read();
int cv2 = gravity.cv2.Read(); int cv2 = gravity.cv2.Read();
int cvmod_clock_mod_index = getClockModIndexWithMod(cv1, cv2); int cvmod_clock_mod_index = getClockModIndexWithMod(cv1, cv2);