From c02cb187a0707220dff12d4ddc0c044e0a524f51 Mon Sep 17 00:00:00 2001 From: Ben Rosenbach Date: Tue, 22 Nov 2022 11:20:49 -0500 Subject: [PATCH] Reseed the loop if CV value changes in ProbMeloD --- software/o_c_REV/HEM_ProbabilityMelody.ino | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/software/o_c_REV/HEM_ProbabilityMelody.ino b/software/o_c_REV/HEM_ProbabilityMelody.ino index 2cde3a3c5..49a7e7d00 100644 --- a/software/o_c_REV/HEM_ProbabilityMelody.ino +++ b/software/o_c_REV/HEM_ProbabilityMelody.ino @@ -55,17 +55,24 @@ public: int downCv = DetentedIn(0); + int oldDown = down; if (downCv < 0) down = 1; if (downCv > 0) { down = constrain(ProportionCV(downCv, HEM_PROB_MEL_MAX_RANGE + 1), 1, up); } int upCv = DetentedIn(1); + int oldUp = up; if (upCv < 0) up = 1; if (upCv > 0) { up = constrain(ProportionCV(upCv, HEM_PROB_MEL_MAX_RANGE + 1), down, HEM_PROB_MEL_MAX_RANGE); } + // reseed loop if range has changed due to CV + if (isLooping && (oldDown != down || oldUp != up)) { + GenerateLoop(); + } + if (Clock(0) || loop_linker->Ready()) { if (isLooping) { pitch = loop[loop_linker->GetLoopStep()] + 60;