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

**URL:** <https://forum.juce.com/t/preparetoplay-is-not-called-when-changing-the-buffer-size-in-the-auv3-host/59244>\
**Category:** MacOSX and iOS\
**Created:** [December 20, 2023, 1:05pm UTC](https://forum.juce.com/t/preparetoplay-is-not-called-when-changing-the-buffer-size-in-the-auv3-host/59244 "2023-12-20T13:05:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Froggo-Lab](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/froggo-lab/32/17809_2.png) [@Froggo-Lab](https://forum.juce.com/u/Froggo-Lab)\
**Post date:** [December 20, 2023, 1:05pm UTC](https://forum.juce.com/t/preparetoplay-is-not-called-when-changing-the-buffer-size-in-the-auv3-host/59244/1 "2023-12-20T13:05:16Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Froggo-Lab](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/froggo-lab/32/17809_2.png) [@Froggo-Lab](https://forum.juce.com/u/Froggo-Lab)\
**Post date:** [December 25, 2023, 9:16am UTC](https://forum.juce.com/t/preparetoplay-is-not-called-when-changing-the-buffer-size-in-the-auv3-host/59244/2 "2023-12-25T09:16:45Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![PluginPenguin](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pluginpenguin/32/10203_2.png) [@PluginPenguin](https://forum.juce.com/u/PluginPenguin)\
**Post date:** [December 25, 2023, 5:16pm UTC](https://forum.juce.com/t/preparetoplay-is-not-called-when-changing-the-buffer-size-in-the-auv3-host/59244/3 "2023-12-25T17:16:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Froggo-Lab](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/froggo-lab/32/17809_2.png) [@Froggo-Lab](https://forum.juce.com/u/Froggo-Lab)\
**Post date:** [December 25, 2023, 5:40pm UTC](https://forum.juce.com/t/preparetoplay-is-not-called-when-changing-the-buffer-size-in-the-auv3-host/59244/5 "2023-12-25T17:40:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bwall](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bwall/32/618_2.png) [@bwall](https://forum.juce.com/u/bwall)\
**Post date:** [December 25, 2023, 7:18pm UTC](https://forum.juce.com/t/preparetoplay-is-not-called-when-changing-the-buffer-size-in-the-auv3-host/59244/6 "2023-12-25T19:18:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![refusesoftware](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/refusesoftware/32/20561_2.png) [@refusesoftware](https://forum.juce.com/u/refusesoftware)\
**Post date:** [December 29, 2023, 5:34am UTC](https://forum.juce.com/t/preparetoplay-is-not-called-when-changing-the-buffer-size-in-the-auv3-host/59244/7 "2023-12-29T05:34:49Z")

</div>

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.
