From 89b13280de93ad2131c12dc234fa65cd10855996 Mon Sep 17 00:00:00 2001 From: thmueller64 <64359888+thmueller64@users.noreply.github.com> Date: Sat, 3 Oct 2020 07:05:55 +0200 Subject: [PATCH] LB302: Use consistent cutoff frequency on mulitple sample rates (#5618) --- plugins/lb302/lb302.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/lb302/lb302.cpp b/plugins/lb302/lb302.cpp index cc671749d..e9a518e3d 100644 --- a/plugins/lb302/lb302.cpp +++ b/plugins/lb302/lb302.cpp @@ -74,7 +74,7 @@ //#define engine::mixer()->processingSampleRate() 44100.0f - +const float sampleRateCutoff = 44100.0f; extern "C" { @@ -228,8 +228,11 @@ void lb302Filter3Pole::envRecalc() // e0 is adjusted for Hz and doesn't need ENVINC w = vcf_e0 + vcf_c0; k = (fs->cutoff > 0.975)?0.975:fs->cutoff; + // sampleRateCutoff should not be changed to anything dynamic that is outside the + // scope of lb302 (like e.g. the mixers sample rate) as this changes the filters cutoff + // behavior without any modification to its controls. kfco = 50.f + (k)*((2300.f-1600.f*(fs->envmod))+(w) * - (700.f+1500.f*(k)+(1500.f+(k)*(Engine::mixer()->processingSampleRate()/2.f-6000.f)) * + (700.f+1500.f*(k)+(1500.f+(k)*(sampleRateCutoff/2.f-6000.f)) * (fs->envmod)) ); //+iacc*(.3+.7*kfco*kenvmod)*kaccent*kaccurve*2000