Best practice for resizing buffers in prepareToPlay


#1

In prepareToPlay(), as the doc says that estimatedSamplesPerBlock is just a hint and isn’t any kind of guarantee,
I always set the size of my buffer as twice the estimatedSamplesPerBlock :

For now I never had more samples than 2 * estimatedSamplesPerBlock in the processBlock, but I guess the behaviour may change depending on the audio drivers and hosts (?)

Is that good practice ? is it always enough or should I double-check everything is fine in processblock?
How are you dealing with this ?

thanks for your opinion!


#2

no one really ?


#3

I can’t definitively say that you won’t get away with doubling the buffer, but its not safe. I always check inside processBlock - it’s not nice to resize your buffers in there, but it’s better than crashing.

I’ve never tested it, but I think I remember reading somewhere that FruityLoops can send a wide variety of buffer sizes, so that’d be a host to be careful of.