commit fb782bd8353efa3494440ea197f1bc658aceaf78
parent 0b5dc72b3b7023b9301ac6d93b56969eea5d4e70
Author: Matt Demanett <matt@demanett.net>
Date: Mon, 13 Apr 2020 18:55:40 -0400
ADDR-SEQ, 8:1, 1:8, PGMR: allow negative addressing.
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/addressable_sequence.cpp b/src/addressable_sequence.cpp
@@ -104,12 +104,17 @@ int AddressableSequenceModule::nextStep(
_select[c] -= _select[c] * reset;
}
else {
- select += clamp(selectInput.getPolyVoltage(c), 0.0f, 9.99f) * 0.1f * (float)n;
+ select += clamp(selectInput.getPolyVoltage(c), -9.99f, 9.99f) * 0.1f * (float)n;
if (!_selectOnClock || clock) {
_select[c] = select;
}
}
- return (_step[c] + (int)_select[c]) % n;
+
+ int s = (_step[c] + (int)_select[c]) % n;
+ if (s < 0) {
+ return n + s;
+ }
+ return s;
}
int AddressableSequenceModule::setStep(int c, int i, int n) {