Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Plugin works but doesn't initialise properly
No permission to create posts
October 6, 2015
6:12 pm
Forum Posts: 5
Member Since:
September 17, 2015
sp_UserOfflineSmall Offline

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
case 0:
m_fVolume = pow(10.0, m_fVolume_dB/20.0);
case 1:
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;




return true;

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! Laugh

October 7, 2015
12:17 am
W Pirkle
Forum Posts: 187
Member Since:
January 29, 2017
sp_UserOfflineSmall Offline

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.

- Will

October 7, 2015
2:53 am
Forum Posts: 5
Member Since:
September 17, 2015
sp_UserOfflineSmall Offline

Thanks for the advice Will. I'll check it out and get back! Also, your books are brilliant! Cheers! Laugh

Forum Timezone: America/New_York

Most Users Ever Online: 36

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 48

Derek: 41

Peter: 41

Frodson: 40

clau_ste: 39

Gwen: 32

EZB: 24

lppier: 23

Msaldaña: 18

Jorge: 17

Member Stats:

Guest Posters: 1

Members: 495

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 31

Topics: 511

Posts: 1966

Newest Members:

CoraDias, Edoardo, knooierd, daniel, Merril Bradshaw, BillPlunkett, Pajczur, michaelwayneharwood, RickM, rainbow wind

Moderators: W Pirkle: 187

Administrators: Tom: 66, JD Young: 80, Will Pirkle: 0, W Pirkle: 187