From d277916c010d1975fbf71288ecadcc60f56b0074 Mon Sep 17 00:00:00 2001 From: Lukas W Date: Tue, 31 Oct 2023 20:25:55 +0100 Subject: [PATCH] Fix instrument release ending one frame early See discussion in https://github.com/LMMS/lmms/pull/6908#issuecomment-1784637574 and following comments. --- src/core/Instrument.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/Instrument.cpp b/src/core/Instrument.cpp index 2f987aaed..27529bd20 100644 --- a/src/core/Instrument.cpp +++ b/src/core/Instrument.cpp @@ -188,7 +188,7 @@ void Instrument::applyRelease( sampleFrame * buf, const NotePlayHandle * _n ) (std::max(fpp - desiredReleaseFrames(), 0) + fl) % fpp : 0); f < frames; ++f) { - const float fac = (float)( fl-f-1 ) / + const float fac = (float)( fl-f ) / desiredReleaseFrames(); for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch ) {