I decided to try out the ProcessorChain in juce::dsp but am having trouble getting it wired up. Currently my VST passes the signal completely unchanged and I’m not sure why.
In Processor.h I have:
juce::dsp::ProcessorChain<juce::dsp::IIR::Filter<float>, Gain> filter_stage_0;
In prepareToPlay I have:
juce::dsp::ProcessSpec spec;
spec.sampleRate = host_sample_rate;
spec.maximumBlockSize = juce::uint32(samplesPerBlock);
spec.numChannels = juce::uint32(getTotalNumOutputChannels());
filter_stage_0.prepare(spec);
filter_stage_0.reset();
In parameterChanged I get some parameters from an AudioProcessorValueTreeState and set the coefficients:
low_cutoff_1 = *tree.getRawParameterValue("low_cutoff_1");
low_q_1 = *tree.getRawParameterValue("low_q_1");
gain_1 = *tree.getRawParameterValue("gain_1");
newCoefficients = juce::dsp::IIR::Coefficients<float>::makeHighPass(
host_sample_rate, low_cutoff_1, low_q_1);
filter_stage_0.get<0>().coefficients = newCoefficients;
filter_stage_0.get<1>().setGainLinear(gain_1);
In processBlock I have:
juce::dsp::ProcessContextReplacing<float> context(
juce::dsp::AudioBlock<float>(buffer)
);
filter_stage_0.process(context);
When the VST is loaded, changing the cutoff or gain does nothing – the audio is being passed through completely unchanged.
I guess I’m just missing a step but looking through the examples / tutorials I can find online hasn’t clarified it for me.