Skip to content

Commit

Permalink
Reseed the loop if CV value changes in ProbMeloD
Browse files Browse the repository at this point in the history
  • Loading branch information
benirose committed Nov 22, 2022
1 parent ccb205a commit c02cb18
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions software/o_c_REV/HEM_ProbabilityMelody.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c02cb18

Please sign in to comment.