diff --git a/plugins/mimid/Engine/AdssrEnvelope.h b/plugins/mimid/Engine/AdssrEnvelope.h index 902e7ea..1ce481c 100644 --- a/plugins/mimid/Engine/AdssrEnvelope.h +++ b/plugins/mimid/Engine/AdssrEnvelope.h @@ -146,8 +146,8 @@ class AdssrEnvelope void setSustain(float sus) { sustain = sus; - sustain_asymptote = calc_sustain_asymptote(); if (state == DEC || state == SUS) { + sustain_asymptote = calc_sustain_asymptote(); // Chase sustain level at decay rate, if sustain // level changed in ADSR mode if (Value > sustain) { @@ -205,6 +205,7 @@ class AdssrEnvelope if (Value > 1.0f) { Value = 1.0f; state = DEC; + sustain_asymptote = calc_sustain_asymptote(); coef = coef_dec(decay); dir = 1; }