diff --git a/src/common/dsp/modulators/LFOModulationSource.cpp b/src/common/dsp/modulators/LFOModulationSource.cpp index b6437342070..5ed50e76450 100644 --- a/src/common/dsp/modulators/LFOModulationSource.cpp +++ b/src/common/dsp/modulators/LFOModulationSource.cpp @@ -77,6 +77,9 @@ void LFOModulationSource::assign(SurgeStorage *storage, LFOStorage *lfo, pdata * { wf_history[i] = 0.f; } + + for (int i = 0; i < 3; ++i) + onepoleState[i] = 0.f; } float LFOModulationSource::bend1(float x) @@ -1289,6 +1292,16 @@ void LFOModulationSource::process_block() output_multi[1] *= useenvval; output_multi[1] += useenv0; } + + if (envRetrigMode == FROM_LAST && lfo->deform.deform_type != type_3) + { + // Now appy the one pole + float alpha = onepoleFactor; + output_multi[0] = (1.0 - alpha) * output_multi[0] + alpha * onepoleState[0]; + output_multi[1] = (1.0 - alpha) * output_multi[1] + alpha * onepoleState[1]; + onepoleState[0] = output_multi[0]; + onepoleState[1] = output_multi[1]; + } } } diff --git a/src/common/dsp/modulators/LFOModulationSource.h b/src/common/dsp/modulators/LFOModulationSource.h index 92a751e3448..752a0074ce0 100644 --- a/src/common/dsp/modulators/LFOModulationSource.h +++ b/src/common/dsp/modulators/LFOModulationSource.h @@ -111,6 +111,8 @@ class LFOModulationSource : public ModulationSource inline int getEnvState() { return env_state; } inline int getStep() { return step; } + float onepoleFactor{0}; + private: pdata *localcopy; bool phaseInitialized; @@ -128,6 +130,8 @@ class LFOModulationSource : public ModulationSource int step, shuffle_id; int magn, rate, iattack, idecay, idelay, ihold, isustain, irelease, startphase, ideform; + float onepoleState[3]; + std::default_random_engine gen; std::uniform_real_distribution distro; std::function urng;