From 1c5a3f8a36dcaca33b44ec3c368f875ae4cff386 Mon Sep 17 00:00:00 2001 From: Hyunjin Song Date: Sun, 26 Apr 2020 17:59:43 +0900 Subject: [PATCH] DrumSynth: ensure correct envelope length in any sample rate (#5467) --- src/core/DrumSynth.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/DrumSynth.cpp b/src/core/DrumSynth.cpp index b39e8f52e..6532ecae2 100644 --- a/src/core/DrumSynth.cpp +++ b/src/core/DrumSynth.cpp @@ -320,6 +320,8 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa timestretch = .01f * mem_time * GetPrivateProfileFloat(sec,"Stretch",100.0,dsfile); if(timestretch<0.2f) timestretch=0.2f; if(timestretch>10.f) timestretch=10.f; + // the unit of envelope lengths is a sample in 44100Hz sample rate, so correct it + timestretch *= Fs / 44100.f; DGain = 1.0f; //leave this here! DGain = (float)powf(10.0, 0.05 * GetPrivateProfileFloat(sec,"Level",0,dsfile));