macroInt: fix off-by-one when bottom>top

issue #1973
issue #1891
This commit is contained in:
tildearrow 2024-07-04 16:33:53 -05:00
parent 49a9de1d93
commit 90878c325d

View file

@ -146,8 +146,9 @@ void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tic
if (ADSR_HIGH>ADSR_LOW) {
val=ADSR_LOW+((pos+(ADSR_HIGH-ADSR_LOW)*pos)>>8);
} else {
val=ADSR_LOW+(((ADSR_HIGH-ADSR_LOW)*pos-pos)>>8);
val=ADSR_HIGH+(((255-pos)+(ADSR_LOW-ADSR_HIGH)*(255-pos))>>8);
}
logV("val: %d",val);
}
if (type==2) { // LFO
lfoPos+=LFO_SPEED;