Delay works with test oscillator but explodes inside daw

Delay.pushSampleReplace(0, sampleL, false); 

SampleL = delay.popsample(0, -1, false);

ValL = sampleL * 0.95;

Delay.pushSampleAverage(0, valL, false);

Delay.updateReadPointer(0);

Delay.updateWritepointer(0)

Is this code faulty?

Thanks, Richard

There are a few variables that appear with different capitalization within your code sample. Is this a cut/paste error, or have you actually defined all of these variables? E.g “Delay” and “delay”, “ValL” and “valL”, “SampleL” and “sampleL” .

Hi. Thanks for the response.

These were typos, sorry.

The actual variable name of “delay” is “linear InterpolatedDelay” which is juce::dsp::Delayline and valL is a float variable inside the process block function.

I also added some functions for mixing such as “pushSampleAverage”.

Sorry for the lack of clarity. There is of course a “valR” as well for stereo.

The code builds and runs fine in standalone and on Windows Reaper and FL Studio (although it did used to explode in feedback on FL Studio sometimes). I’m now testing with X Code and Logic Pro and it either goes silent or gives an extreme feedback distortion - clipped sound.

I always call buffer.getNumSamples() so Im not sure how it could be caused by buffer sizes.

I meant to ask “is the delay logic faulty?” and what could cause the DAW behaviour?

Thanks!

Richard

Just a couple of basic things to remember…

processBlock in PluginProcessor can receive different block sizes which you have to honour. People have been caught out before hard-coding block sizes in their code.

Likewise, make sure you handle the sample rate given in PluginProcessor’s prepareToPlay to size your delay buffers accordingly.

1 Like

Hi, thanks.

I suppose it can only be caused by accommodating buffer sizes coming in… I need to look harder.

Thanks, Richard.

I solved the problem. I had a moduleBuffer where the size needed to be set to original buffer.getNumSamples()

Thanks

Richard