Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LB302: Prevent cutoff frequency modification when the sampling rate changes. #5618

Merged
merged 2 commits into from
Oct 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions plugins/lb302/lb302.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@


//#define engine::mixer()->processingSampleRate() 44100.0f

const float sampleRateCutoff = 44100.0f;

extern "C"
{
Expand Down Expand Up @@ -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

Expand Down