Fix instrument release being applied early

As discovered by @michaelgregorious & @zonkmachine, applyRelease's
condition to determine whether the release ramp starts within the
current buffer was off by 1 frame, running the release code when the
ramp should only start in frame 0 of the next buffer. This could cause
the ramp to be miscalculated, starting at a value greater than 1.0 and
and thus actually amplifying the signal.
This commit is contained in:
Oskar Wallgren
2023-10-13 22:34:41 +00:00
committed by Lukas W
parent d962070d7c
commit bf5f4a7994

View File

@@ -182,7 +182,7 @@ void Instrument::applyRelease( sampleFrame * buf, const NotePlayHandle * _n )
const fpp_t frames = _n->framesLeftForCurrentPeriod();
const fpp_t fpp = Engine::audioEngine()->framesPerPeriod();
const f_cnt_t fl = _n->framesLeft();
if( fl <= desiredReleaseFrames()+fpp )
if( fl < desiredReleaseFrames()+fpp )
{
for( fpp_t f = (fpp_t)( ( fl > desiredReleaseFrames() ) ?
(std::max(fpp - desiredReleaseFrames(), 0) +