From 82f86a245221fd882d6e4ba36507720eec52e7fc Mon Sep 17 00:00:00 2001 From: Joel Blanco Berg Date: Tue, 27 Aug 2024 00:50:45 +0200 Subject: [PATCH] initial morph value fix (#7775) * initial morph value fix If you modulated the morph value, the initial is never set. instead it interpolates to the initial value from zero, which can cause a glitch in the beginning of each note. * Update WavetableOscillator.cpp --------- Co-authored-by: EvilDragon --- src/common/dsp/oscillators/WavetableOscillator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/dsp/oscillators/WavetableOscillator.cpp b/src/common/dsp/oscillators/WavetableOscillator.cpp index 742361198d6..9a7b7f3fa0b 100644 --- a/src/common/dsp/oscillators/WavetableOscillator.cpp +++ b/src/common/dsp/oscillators/WavetableOscillator.cpp @@ -84,7 +84,9 @@ void WavetableOscillator::init(float pitch, bool is_display, bool nonzero_init_d // nointerp adjusts the tableid range so that it scans the whole wavetable // rather than wavetable from first to second to last frame nointerp = !oscdata->p[wt_morph].extend_range; - float shape = oscdata->p[wt_morph].val.f; + + float shape = l_shape.v; + float intpart; shape *= ((float)oscdata->wt.n_tables - 1.f + nointerp) * 0.99999f; tableipol = modff(shape, &intpart);