Copying a Buffer

Hi everyone,

I know this may be a basic JUCE question, but how do you copy a buffer? I am trying to create a multiband compressor using Linkwitz–Riley filters, and I don’t know how to separate the buffers effectively.

Thank you,

juce::AudioBuffer<float> newBuffer;
newBuffer.makeCopyOf (const AudioBuffer< OtherType > &other, bool avoidReallocating=false)

This should do what you want.


1 Like

Hi David,

Is there a limit of the number of copies of a buffer with makeCopyOf inside processorBlock of a plugin?

If it is serial processing consider ProcessorChain.


Theoretically no. In practice it may create audio glitches when allocating on the audio thread if you do too much. I have found that allocating the memory in prepare to play and then setting avoidReallocating = true in makeCopyOf() tends to avoid this - I however haven’t looked into this too much so may be coincidental.