dsp::DelayLine feedback?

So i’m trying to add a feedback functionality to my plugin using the delayLine dsp module, although i’m sure i’m doing it wrong… I was able to set the delay rate, yet now that i’m trying different ways for feeding back using that inner-loop i get some really weird yet interesting noises… (Volume Caution):
https://drive.google.com/file/d/1t2vytVAAifeuGNClVgwVxi6_8xAPnaPR/view?usp=sharing)
At least that last bit at the end i though was pretty cool lol.
At one point i thought i even blew out my speakers…
Anyway, any advice on how to do this? I know i should be popping back out all those samples

    for (int sample = 0; sample<buffer.getNumSamples(); ++sample)
    {
        
        delayLine.setDelay(noteMult(sliderRateValue->load()) * sixtyFourthNote);
        delayLine.pushSample(channel, channelData[sample]);
        
        //samplesToPop initialized at 1
        for (int i=0; i<samplesToPop; i++)
        {
        channelData[sample] += delayLine.popSample(channel);
        }
        
        samplesToPop = 0;
        
        for (int fb = 0; fb<feedBackValue->load(); ++ fb)
        {
            delayLine.pushSample(channel, channelData[sample]);
            samplesToPop ++;
        }
        
    }

First, you can probably call setDelay() once at the start as it’s not changing so often.

Then for each sample you only want to push one sample into the delay line (including the feedback) and pop one out, so something like:

float output;
float feedback = feedBackValue->load(); //needs scaling 0.0 to 1.0?

for (int sample = 0; sample<buffer.getNumSamples(); ++sample)
{
    output = delayLine.popSample(channel);
    delayLine.pushSample(channel, channelData[sample] + feedback * output);
    channelData[sample] += output;
}

I get your logic, but i’m still not getting the right sound with that although it’s definitely in the right path.


I also tried looking at Joshua’s basic delay implementation on his git but i don’t entirely understand his code

Update: You were correct, problem was i had implemented my delay rate wrong for the value at 1, i had it return 0 delay and that was messing things up. Thanks!