When I start my plugin for testing it initialises with a "blown up" frequency response (see link for picture):
I'm sure there's an initialisation step I missing to avoid this. I'm basically dumping my code into the slider id switch statement to change the parameters:
bool __stdcall CGenericBiQuadMultifilter::userInterfaceChange(int nControlIndex)
// decode the control index, or delete the switch and use brute force calls
m_fVolume = pow(10.0, m_fVolume_dB/20.0);
if(m_u_filter_type == FO_LPF)
fc = m_fSlider_fc;
Q = m_fSlider_Q;
theta_c = 2*pi*fc/fs;
gamma = cos(theta_c)/(1 + sin(theta_c));
m_f_a0_left = (1 - gamma)/2;
m_f_a0_right = (1 - gamma)/2;
m_f_a1_left = (1 - gamma)/2;
m_f_a1_right = (1 - gamma)/2;
m_f_a2_left = 0.0;
m_f_a2_right = 0.0;
m_f_b1_left = -gamma;
m_f_b1_right = -gamma;
m_f_b2_left = 0.0;
m_f_b2_right = 0.0;
This is happening with all my plugins so far ( I really want to get rid of this dodgy coding error). Any help would be most appreciated!
This part of your code is for calculating the coefficients only. If you want to check these calculations, there is an easy way to do this with RackAFX:
Open RackAFX and choose Modules -> HP/LP Filter
This built-in module implements the 1st and 2nd order LPF and HPF that are in the book.
Next, choose View -> Block Diagram
A block diagram appears for the filter. Now, move the Fc slider around - you can see the filter coefficients update as you move the control (of course you can also do this with audio streaming).
If you set a breakpoint in your code to catch the calculations, you can compare the coefficients to the ones in the Block Diagram and see if you have any errors.
If the coefficients look good, my guess would be that you are not zero-ing out your z^-1 storage registers in prepareForPlay() -- if there is garbage in those registers when the filter cranks up, it will result in a blow-up.
Most Users Ever Online: 152
Currently Browsing this Page:
Guest Posters: 1
Newest Members:Jas, Rowan, sojourn, fabhenr, rg1, Niklas, Wutru, Tim Campbell, Danny Jonel, Valentin
Moderators: W Pirkle: 573
Administrators: Tom: 74, JD Young: 80, Will Pirkle: 0, W Pirkle: 573, VariableCook: 3