For an FFT-related application, I’m using two buffers, “buffer” & “OverflowSampleBuffer”.
buffer (input to process) is 256 samples per channel and can be thought of as x(0), x(1),…x(N-1).
OverflowSampleBuffer is around 800 samples per channel and is x(-800), x(-799), … x(-1), where x is my signal of interest.
My algorithm requires the value of a sample 800 time steps in the past, but I also have a low latency requirement, hence I chose 256 samples for “buffer”, and keep the past values in the “OverflowSampleBuffer”.
My problem is that at the end of my process, I need to shift the “OverflowBuffer” back by 256 samples (discarding the earliest 256 samples) and move all the samples of the “buffer” into the “OverflowSampleBuffer”.
The function CopyFrom does not allow the source and destination to be the same buffer, which is making the former half of the copying step problematic. I get an assertion failure due to this line in juce_AudioSampleBuffer.cpp:
jassert (&source != this || sourceChannel != destChannel);
Is there any other efficient way to move data around in the way that I’ve described?