Skip to content

Commit

Permalink
Fix crash-on-add for ADDR-SEQ, 8:1, 1:8. #48
Browse files Browse the repository at this point in the history
  • Loading branch information
mdemanett committed May 11, 2019
1 parent eac5dbd commit 1333385
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/AddrSeq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void AddrSeq::step() {
bool timer = _timer.next();
bool clock = _clock.process(inputs[CLOCK_INPUT].value) && !timer;

int steps = params[STEPS_PARAM].value;
int steps = clamp(params[STEPS_PARAM].value, 1.0f, 8.0f);
int reverse = 1 - 2 * (params[DIRECTION_PARAM].value == 0.0f);
_step = (_step + reverse * clock) % steps;
_step += (_step < 0) * steps;
Expand Down
2 changes: 1 addition & 1 deletion src/EightOne.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void EightOne::step() {
bool timer = _timer.next();
bool clock = _clock.process(inputs[CLOCK_INPUT].value) && !timer;

int steps = params[STEPS_PARAM].value;
int steps = clamp(params[STEPS_PARAM].value, 1.0f, 8.0f);
int reverse = 1 - 2 * (params[DIRECTION_PARAM].value == 0.0f);
_step = (_step + reverse * clock) % steps;
_step += (_step < 0) * steps;
Expand Down
2 changes: 1 addition & 1 deletion src/OneEight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void OneEight::step() {
bool timer = _timer.next();
bool clock = _clock.process(inputs[CLOCK_INPUT].value) && !timer;

int steps = params[STEPS_PARAM].value;
int steps = clamp(params[STEPS_PARAM].value, 1.0f, 8.0f);
int reverse = 1 - 2 * (params[DIRECTION_PARAM].value == 0.0f);
_step = (_step + reverse * clock) % steps;
_step += (_step < 0) * steps;
Expand Down

0 comments on commit 1333385

Please sign in to comment.