Interesting. If this works as expected in VST3, but not AU, it could be something with the host. Which host(s) are you testing in?
I have not encountered such a problem myself, but I always put a check to make sure prepareToPlay() has been called before letting the processBlock process anything.
Just something simple like this could be good enough: if(!prepared) return;
Where prepared is a bool initialized to false, and set to true after prepareToPlay() is called. (it should probably be an atomic bool).
This kind of code also helps verify that prepareToPlay() is the source of errors or not. “unusual crackling” that is fixed by a hard audio reset could be anything, including badly initialized buffers.
Glad to hear you fixed the problem.
In the interest of informing others who may be searching this forum in the future, what was the cause and solution to the issue?
So, the cause of this problem is unknown - (that’s why I posted on here - if anyone has any further information, please let us know) - as it seems to be symptomatic to AU2.
The solution is similar to yours - ensuring prepare to play is called one way or another…