In my plugin processing logic, I’m currently copying the AudioBuffer into a preAudioBuffer before the processBlock, and then copying the same AudioBuffer into a postAudioBuffer after the processing is done.
I’d like to know:
What is the computational cost of this operation?
If I had, say, 300 plugins doing this, how much would it impact performance?
Not sure if I understand the question. Copying buffers around (e.g. for all kinds of routing purposes) is kind of a bread and butter operation just like adding or multiplying a gain. It’s not like it’s a crazy kind of thing to do or to avoid. Literally anything else your plugin does in between will very likely be more expensive if it’s any meaningful, and whatever that is will dominate your plugin’s performance.
With the caveat that the copy destination buffers should be preallocated to a sufficient size outside the audio thread. You wouldn’t want to allocate/deallocate the buffers during the audio processing. Which you might accidentally do if you do for example something like AudioBuffer<float> copiedBuffer = sourceBuffer; in the audio thread code.