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:
@@ -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) +
|
||||
|
||||
Reference in New Issue
Block a user