First of all, I just noticed that I shared a different source file than intended, as this actually does not re-compute coefficients during processing but switches between two precomputed coefficient sets by re-assigning the processor duplicatord state
member. To break it down, the main point is
// Declare a multi channel capable filter itself like this
juce::dsp::ProcessorDuplicator<juce::dsp::IIR::Filter<float>, juce::dsp::IIR::Coefficients<float>> filter;
// Assign new coefficients like this
*filter.state = juce::dsp:ArrayCoefficients<float>::makeXY (foo, bar);
Then regarding stack vs heap, Daniel already mentioned the important difference. Tbh. I would always go for the ArrayCoefficients
, there is no real downside using it as default.