BUG - juce_AudioUnitPluginFormat.mm

Hi JUCE devs,

I’m working on an audio plug-in host using Juce, and I’ve found a distinct problem with hosting on iOS.

The app’s transport control starts/stops the hosted plug-ins at various times.

It does this by calling prepareToPlay() on each plug-in in response to start events in the UI.

That calls releaseResources() in the plug-in.

That in turn calls AudioUnitReset (audioUnit, kAudioUnitScope_Global, 0);

That in turn seems to lose the plug-in callbacks - so on 2nd playback and later, the Audio Unit stops responding!

My fix was to do this:

    void prepareToPlay (double newSampleRate, int estimatedSamplesPerBlock) override
    {
        if (audioUnit != nullptr)
        {
            releaseResources();

            createPluginCallbacks(); // MPC added!

… that restores the callbacks, and the AudioUnit now works on 2nd and subsequent playbacks.

This looks like a clear bug to me. Am I missing something?!

Best wishes to all,

Pete

Thanks for the report. It looks like some AUs will remove the host callbacks when being uninitialised or reset so we need to re-add them in prepareToPlay(). We don’t want to re-add the parameter listeners on macOS though so the createPluginCallbacks() call needs to be modified a bit to split out the callback/listener logic.

We’ve got a fix for this that will go onto develop after the 6.1.1 bugfix release.

Fabulous, @ed95 ! Looking forward to seeing the patch.

Best wishes, Pete

This is on develop now:

Thanks @ed95 !

With many thanks to the JUCE team - Wotja 22 is going to be a great release.

Best wishes,

Pete