Hey y’all - having a bit of a frustrating buffer copyFrom issue. Essentially I have a time-based effect with a “freeze” mode - which replays the same “frozen” buffer over and over. However, the performance of copying from the freeze buffer to the main buffer is inconsistent and slow. Here is the code segment which does the copying, any advice is welcome:
int remainingSamples = numSamples;
int bufferPosition = 0;
while (remainingSamples > 0)
{
int samplesToCopy = std::min(remainingSamples, stutterLength - freezeBufferReadPosition);
buffer.copyFrom(channel, bufferPosition, freezeBuffer, channel, freezeBufferReadPosition, samplesToCopy);
bufferPosition += samplesToCopy;
freezeBufferReadPosition += samplesToCopy;
remainingSamples -= samplesToCopy;
if (freezeBufferReadPosition >= stutterLength)
freezeBufferReadPosition = 0;
}
