Cont float prevents writing/processing, need help

for (int channel = 0; channel < totalNumInputChannels; ++channel)
const float* bufferData = buffer.getReadPointer(channel);
const float* delayBufferData = mDelayBuffer.getReadPointer(channel);
float* dryBuffer = buffer.getWritePointer(channel);

fillDelayBuffer (channel, bufferLength, delayBufferLength, bufferData, delayBufferData);

Need some support finding a way to have the bufferData within the fillDelaybuffer function to be writable using.

Pointer = lowPassFilter0.processSingleSampleRaw(Pointer);

I’m almost sure that a cast of const float* bufferData is not the solution here. Adding a write option as const float* bufferwriteData = buffer.getWritePointer(channel); is not a possible way as it is used unprocessed somewhere else. a duplicate of this to a read/writable buffer is possible the best candidate?

As a retiree, I’m uncertain what the best approach is after many days of considerations (while relearning C++) without having workable conclusions spinning in my head.


getWritePointer is already the solution. But you should assign it to a float* not a const float*.
The const makes it again read only.

float* bufferwriteData = buffer.getWritePointer (channel);
// or even better:
auto* bufferwriteData = buffer.getWritePointer (channel);

Hope that helps

thanks Daniel,
Th problem is that the buffer is going to be overwritten. a second kind of scratch buffer that’s offered to the filldelaybuffer would prevent that.


I am not sure if I understand the problem, but the getReadPointer(channel) and getWritePointer(channel) point to the same address, just one is writeable and the other isn’t.

If you need a place to copy the audio data to, you need to add an juce::AudioBuffer as member to your processor and allocate a buffer in a suited size in your prepareToPlay() method.

Note that processSingleSampleRaw takes in a single float variable and returns a single float variable, it doesn’t work with pointers. You could dereference the pointer, though, like :

*Pointer = lowPassFilter0.processSingleSampleRaw(*Pointer);

But I have a suspicion this isn’t what you really want to be doing…


Main problem is avoiding a replica of the buffer in the processblock due to time-impact on that copy process. Having that buffer being overwritten is not my goal as this is to be kept as-is. Thanks!

You won’t have much choice than copying for the feedback. I tried once…
And the copy is actually no big deal for the processor.

Good luck

I’ve added
mWetBuffer.copyFrom(channel, 0, buffer, channel, 0, wetbufferLength);

to duplicate the buffer. Seems to work although also generates presently some transients. Good starting point here!

First a big thanks for the great hints you’ve given! My last question…

I’ve successfully duplicated the buffer and started to apply the filter to both channels. Would it be better to apply the filter to each channel separately to avoid artifacts? Also, would a duplicated buffer the best way forward or would you suggest a different approach when applying a filter?