Can't Update Filter IIR::Coeffs In Plugin?

Hi there,

I know this may be a stupid question but i have been rooting around on this site for days and days now trying to find an answer to why i cant seem to update my IIR::filters mid session after opening my plugin. I think the problem lies within when and where im trying to update them but i cannot find a working way of doing it at all. So where and how would one update these filters?

Any help would be appreciated.

in Processor.h: (This is the type of filter etc that i am using)

private:
OwnedArray<dsp::IIR::Coefficients<float>>    m_Low_LoMid_XOArray;
OwnedArray<dsp::IIR::Coefficients<float>>    m_LoMid_Mid_XOArray;
OwnedArray<dsp::IIR::Coefficients<float>>    m_Mid_MidHi_XOArray;
OwnedArray<dsp::IIR::Coefficients<float>>    m_MidHi_High_XOArray;

dsp::ProcessorDuplicator<dsp::IIR::Filter<float>, dsp::IIR::Coefficients<float>>Low_LP;
dsp::ProcessorDuplicator<dsp::IIR::Filter<float>, dsp::IIR::Coefficients<float>>Low_LP2;

in Processor.cpp: (This function seems to work fine upon prepare to play etc)

void DistortionTest2AudioProcessor::UpdateFilters()
{
//Inbuilt, comment out to use GUI Update
_Low_MidLoXO = *TreeState.getRawParameterValue("F1");
_MidLo_MidXO = *TreeState.getRawParameterValue("F2");
_Mid_MidHiXO = *TreeState.getRawParameterValue("F3");
_MidHi_HighXO = *TreeState.getRawParameterValue("F4");

//Dont change
float f1 = _Low_MidLoXO;
float f2 = _MidLo_MidXO;
float f3 = _Mid_MidHiXO;
float f4 = _MidHi_HighXO;

if (bands >= 2) //Per band
{
	ReferenceCountedArray<dsp::IIR::Coefficients<float>> Low_LPCoeffs = dsp::FilterDesign<float>::designIIRLowpassHighOrderButterworthMethod(f1, SampRate, 1); //Create a butterworth filter coeff structure
	ReferenceCountedArray<dsp::IIR::Coefficients<float>> LoMid_HPCoeffs = dsp::FilterDesign<float>::designIIRHighpassHighOrderButterworthMethod(f1, SampRate, 1); //and the opposing highpass

	for (auto Coeff : Low_LPCoeffs)
		m_Low_LoMid_XOArray.add(new dsp::IIR::Coefficients<float>(*Coeff)); //Add those coeffs to an array per xo

	for (auto Coeff : LoMid_HPCoeffs)
		m_Low_LoMid_XOArray.add(new dsp::IIR::Coefficients<float>(*Coeff));

	*Low_LP.state = *m_Low_LoMid_XOArray[0]; //update the xo's filters with the new coeffs (one coeff per pair)
	*Low_LP2.state = *m_Low_LoMid_XOArray[0];
	*LoMid_HP.state = *m_Low_LoMid_XOArray[1];
	*LoMid_HP2.state = *m_Low_LoMid_XOArray[1];

Editor.cpp: (The issue i think is finding the right place for the call? But it doesnt work here which i thought it should.)

void DistortionTest2AudioProcessorEditor::FreqChange()
{
processor.UpdateFilters();
}

Like i say sorry for such a stupid question but if anyone knows where i am going wrong or can point me towards the correct resource i’d be appreciative.

Thanks again,
Sulkyoptimism

Hi! Did you ever get to the bottom of this? Also hitting this wall trying to change the coefficients of Butterworth filters!

I cant quite remember, it was a university project so its been long forgotten, but i think i ended up using other filter types in JUCE, i’ll have a look for the code now. But no promises i can find it.

Thanks! That would be amazing.