Adding IIR filter to a delayed wet signal?


I’m quite new to using JUCE and have been trying to create a delay effect that has an IIR filter on the delayed buffer. Currently I have a working delay which I made following this tutorial (Juce Tutorial 40- Building a Delay Plugin Pt 1 (Creating a Circular Buffer) - YouTube) and can successfully filter the full signal. However, when I try and filter the delayed buffer I blow up the meters to red and just get white noise. I am not sure what I have to do here and am hoping somewhere here might have an idea.

In the code I try and pass the delayBuffer into the IIR filter and get the results stated above. If I pass in the buffer that is passed into the ProcessBlock function then it works fine, but filters the whole signal.

I have attached both the .cpp and .h file. PluginProcessor.cpp (9.3 KB) PluginProcessor.h (3.1 KB)

Thanks in advance.

For anyone who might be interested I was able to fix the issue!

Basically I created a temporary buffer that the delayed signal was added to, filtered that and then summed it to the dry signal. From what I can guess the filter was not behaving when it was applied directly to the delayed signal and created a feedback loop of sorts.

I’ve linked the working code below.
PluginProcessor.cpp (9.9 KB) PluginProcessor.h (3.1 KB)