View Full Version : update filter coefficients
bozmillar
12-06-2010, 05:29 PM
Hey guys, if I'm making an IIR filter and I want to update the coefficients when a slider is changed, where is the best place to update the coefficients?
Is there a call that only takes place when a parameter changes on a fader or knob? My initial thought is updating on mouseDown(), but I can't imagine that's really the best way to do it.
If you update them in OnMouseDown(), then it will only work if the slider/knob changes in the GUI, but not in the generic UI, or when using automation. So you could better update them in OnParamChange(), which will automatically be called from the GUI if a control is tied to the plug-in parameter.
RRokkenAudio
12-07-2010, 03:10 AM
I set everything in onparamchange, assigning variables etc.
in .h
void OnParamChange(int paramIdx) ;
eg.. in cpp
void BussComp::OnParamChange(int paramIdx) {
m_speed = GetParam(SPEED)->Value();
m_ratio = GetParam(RATIO)->Value();
}
Still wonder why Schwa didn't put that in the example, and assigns stuff in the process loop then, says don't do that in the process loop in his comments hahaha..
~Rob.
cerberus
12-07-2010, 03:33 AM
as far as i can tell, the host will only read plug-in parameters once per block, and also is limited when the block sizes indicates to update more frequently than IPlug's u.i. drawing rate (24 fps is default). one simply cannot force drawing/updating to breach these limits.
so if you are attempting a sweepable filter, for example one that could be modulated by lfo...
then there would need to be updates to the audio signal in the sample loop (in order to avert
zipper noise); but any attempt force these updates to read or write from the u.i. at a rate
faster than the limits i mentioned above do impose, would result in a tremendous waste of cpu.
cerberus
12-07-2010, 03:37 AM
Still wonder why Schwa didn't put that in the example, and assigns stuff in the process loop then, says don't do that in the process loop in his comments hahaha..
i recently heard a rumour that schwa is related to WALTER... walter matthau?
in any event, i do find that comment in the example quite funny. :-D
so if you are attempting a sweepable filter, for example one that could be modulated by lfo...
then there would need to be updates to the audio signal in the sample loop (in order to avert
zipper noise)
I don't think reading the parameters in the ProcessDoubleReplacing() will change anything, as the host will still update the LFO automated parameter only once per block.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.