The jassert happens in an AUv3 built with the develop branch, loaded in iOS Garageband – not sure why, but it happens (very reliably) when I’m summoning a texteditor component.
scratch.getNumChannels is equal to 2, and popIdx is equal to 2 when the jassert is fired.
The pop() function is called at the end of the renderCallback from juce_AUv3_Wrapper.mm
It seems that when the assert happens, the renderCallback is called with the ‘if (lastTimeStamp.mSampleTime != timestamp->mSampleTime)’ being false, hence ‘audioBuffer.reset()’ is not called for that renderCallback, so popIdx is not reset to 0. Calling ‘audioBuffer.reset()’ when ‘lastTimeStamp.mSampleTime == timestamp->mSampleTime’ fixes the issue, although I don’t know if it is a good fix or an horrible one !
It does not happen 100% of the time on my iPad, but 10% of the time I get the “JUCE Assertion failure in juce_AU_Shared.h:189” after clicking in the text editor of the AUv3 in Garageband
Only popping inside the conditional seems to be the way to go here. I’ve just pushed a fix to the develop branch, but I’m a little concerned that I don’t know what Apple expects to happen with repeated timestamps…