diff --git a/src/sfizz/ADSREnvelope.cpp b/src/sfizz/ADSREnvelope.cpp index fa952373c..b6080fca6 100644 --- a/src/sfizz/ADSREnvelope.cpp +++ b/src/sfizz/ADSREnvelope.cpp @@ -102,9 +102,17 @@ void ADSREnvelope::getBlockInternal(absl::Span output) noexcept // prevent computing the segment further than release point size = std::min(size, releaseDelay); } else if (releaseDelay == 0 && delay <= 0) { + if (delay < 0) { + // release takes effect this frame + currentState = State::Release; + } else { + // release takes effect the next frame + size = 1; + } + releaseDelay = -1; + } else if (releaseDelay == -1 && currentState < State::Release && delay <= 0) { // release takes effect this frame currentState = State::Release; - releaseDelay = -1; } }