Hi all,
I need help to understand how to set the parameters of a stateVariableFilter of the juce_dsp module, when used in conjunction with a processorDuplicator and a GUI to input the parameters.
In my PluginProcessor.h I have :
enum
{
noiseIndex,
filterIndex,
masterGainIndex
};
using Filter = juce::dsp::IIR::Filter<float>;
using FilterCoefs = juce::dsp::IIR::Coefficients<float>;
juce::dsp::ProcessorChain<MyCustomNoiseGenerator<float>, juce::dsp::ProcessorDuplicator<Filter, FilterCoefs>, juce::dsp::Gain<float>> processorChain;
The issue arises when I try to access the filter to set the parameters in an updateFilter() function of the PluginProcessor.cpp. I can’t get the right syntax (what I am missing?) to achieve something like this (which is obviously wrong):
void MyNoiseFiltersAudioProcessor::updateFilter()
{
int menuChoice = *filterMenuParameter;
int cutoff = *cutoffParameter;
int res = *resonanceParameter;
if (menuChoice == 0)
{
processorChain.get<filterIndex>().state->type = dsp::StateVariableFilter::Parameters<float>::Type::lowPass;
processorChain.get<filterIndex>().state->setCutOffFrequency (lastSampleRate, cutoff, res);
}
Any suggestion?