Is mixing AudioBuffer and AudioBlock processing ok?

In audio plugins; will the actual DSP processing be more efficient if I use the AudioBlock instead of AudioBuffer whenever I can?

I wonder since I suspect that some of the ideas I’ll try to implement won’t be possible with AudioBlock due to lack of support from some other Juce classes. So then I might have a situation where I need to re-access the buffer from AudioBlock and continue on a AudioBuffer basis for portions of the processing, and maybe vice versa.

So the question is if it’s ok to mix in portions of AudioBlock processing if I still also need to do some processing on the AudioBuffer view of the data. Or should I do all processing on AudioBuffer in this case? Although then I’ll miss some convenience…

The main idea is to use AudioBuffer when the audio data is owned and AudioBlock to reference the samples.
The difference is due to historic reasons, the AudioBlock was just added a few years ago, while AudioBuffer probably existed from the beginning.

Note AudioBuffer can also be used non owning using the constructor that takes a float** array.

Since you mention view: You could see AudioBlock as view on an AudioBuffer.

1 Like