Avatar

Please consider registering
Guest

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
Avatar
ggh1984
Member
Members
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):
https://www.dropbox.com/s/w8e3aaqk5geky5j/Screenshot%202015-10-06%2014.01.52.png?dl=0

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
switch(nControlIndex)
{
case 0:
{
m_fVolume = pow(10.0, m_fVolume_dB/20.0);
break;
}
case 1:
{
if(m_u_filter_type == FO_LPF)
{
fc = m_fSlider_fc;
Q = m_fSlider_Q;
fs=44100.0;
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;

}

break;
}

default:
break;
}

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
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 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
Avatar
ggh1984
Member
Members
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:
4 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 47

Peter: 41

Derek: 41

clau_ste: 39

Frodson: 38

Gwen: 32

EZB: 24

lppier: 23

Msaldaña: 18

Jorge: 17

Member Stats:

Guest Posters: 1

Members: 477

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 30

Topics: 483

Posts: 1877

Newest Members:

Jaggxn, sam, annaharris, Marie Weaver, kev, Steven, Mr Anderson, mguy, omelc

Moderators: W Pirkle: 143

Administrators: Tom: 65, JD Young: 80, Will Pirkle: 0, W Pirkle: 143