Hello fellow Jucers,
i want to create a HighPass - LowPass filter plugin using the IIR filter,
in my PluginProcessor.h i have included as private:
IIRFilter monoFilterHighP, monoFilterLowP;
and my PluginProcessor.cpp looks like this:
void DaBorderAudioProcessor::prepareToPlay(double newSampleRate, int /*samplesPerBlock*/)
{
// Use this method as the place to do any pre-playback
// initialisation that you need..
sampleRate = newSampleRate;
monoFilterHighP.setCoefficients(IIRCoefficients::makeHighPass(newSampleRate, *LPFREQParam, q));
monoFilterLowP.setCoefficients(IIRCoefficients::makeLowPass(newSampleRate, *HPFREQParam, q));
reset();
}
void DaBorderAudioProcessor::processBlock(AudioBuffer<float>& buffer, MidiBuffer& midiMessages)
{
auto totalNumInputChannels = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
buffer.clear(i, 0, buffer.getNumSamples());
monoFilterHighP.setCoefficients(IIRCoefficients::makeHighPass(sampleRate, *LPFREQParam, q));
monoFilterLowP.setCoefficients(IIRCoefficients::makeLowPass(sampleRate, *HPFREQParam, q));
for (int channel = 0; channel < totalNumInputChannels; ++channel)
{
auto* channelData = buffer.getWritePointer(channel);
monoFilterHighP.processSamples(channelData, buffer.getNumSamples());
monoFilterLowP.processSamples(channelData, buffer.getNumSamples());
}
}
The problem is that i get some kind of unstable operation for the Hipass filter on the Right channel,
Any ideas?