Add setSampleRate to BasicFilters and update LOMM allpass sample rate (#7048)

This commit is contained in:
Lost Robot
2024-01-04 15:31:22 -08:00
committed by GitHub
parent c2f2b7e0d7
commit 56e7f7de50
3 changed files with 11 additions and 12 deletions

View File

@@ -328,6 +328,16 @@ public:
}
}
inline void setSampleRate(const sample_rate_t sampleRate)
{
m_sampleRate = sampleRate;
m_sampleRatio = 1.f / m_sampleRate;
if (m_subFilter != nullptr)
{
m_subFilter->setSampleRate(m_sampleRate);
}
}
inline sample_t update( sample_t _in0, ch_cnt_t _chnl )
{
sample_t out;

View File

@@ -81,6 +81,7 @@ void LOMMEffect::changeSampleRate()
m_lp2.setSampleRate(m_sampleRate);
m_hp1.setSampleRate(m_sampleRate);
m_hp2.setSampleRate(m_sampleRate);
m_ap.setSampleRate(m_sampleRate);
m_coeffPrecalc = -2.2f / (m_sampleRate * 0.001f);
m_needsUpdate = true;
@@ -98,16 +99,6 @@ void LOMMEffect::changeSampleRate()
}
}
void LOMMEffect::clearFilterHistories()
{
m_lp1.clearHistory();
m_lp2.clearHistory();
m_hp1.clearHistory();
m_hp2.clearHistory();
}
bool LOMMEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames)
{

View File

@@ -52,8 +52,6 @@ public:
return &m_lommControls;
}
void clearFilterHistories();
inline float msToCoeff(float ms)
{
return (ms == 0) ? 0 : exp(m_coeffPrecalc / ms);