"prepareToPlay" is not called when changing the buffer size in the AUv3 host

Hello everyone!

I’m building a plugin as AUv3, and the prepareToPlay method in my PluginProcessor is only being called during the plugin initialization and is not called when changing the buffer size in the host (AUM, AudioBus).
I can’t find the reason; does the AUv3 logic differ from VST and Standalone? I didn’t have such problems with them.

Thanks in advance for any help!

I decided to check the real buffer size in the process block and proceed from this, if anyone knows a better solution, I would be glad for the advice, thanks!

Are the buffers that you get bigger than the maximum number announced in prepareToPlay? If so, that sounds a bit off. Otherwise, note that the buffer size reported in prepareToPlay is the maximum buffer size and that every audio callback after that is allowed to send you buffer sizes between 1 sample and the reported maximum, it’s not a value that you are guaranteed to get with every callback. Your processing code has to be able to work with that range of buffer sizes.

2 Likes

Thank you! In prapareToPlay, I get 2048 buffer size, and smaller in the process block, what is actually configured in the host. Is it specific only AUv3 or VST/AAX and so on have similar behavior?

An oddity of the way hosts use processBlock() is that the buffer size can be any size up the max reported in prepareToPlay(). And it can be different for every block! So you must write your processBlock() code to accommodate whatever size is passed in. And each host can do it differently. So, there is no pattern amongst AAX/VST/VST3/AU etc.

2 Likes

I believe that for AAX, prepareToPlay will now always tell you 1024 samples, which is the maximum buffer size that ProTools can be set to. If I remember correctly, this change was made in JUCE fairly recently (like last year or two) to fix some bug with the AAX wrapper.

2 Likes