Default Projucer-Generated Audio Unit MIDI Effect plugin fails assertion

I’m currently working on an audio unit MIDI effect plugin. Unfortunately, when I add it to AudioPluginHost, it fails an assertion (juce_AudioSampleBuffer.h line 520). I have not modified the generated project beyond making sure “plugin midi input”, “plugin midi output” and “midi effect plugin” are checked in the projucer, and setting a bundle identifier and plugin manufacturer.

If I comment out the assertion that fails, then there don’t appear to be any crashes, except that the audio unit has two audio outputs and a midi output, and no inputs. In another project, I somehow got it to have a MIDI input as well, but I don’t remember how.

If I start AudioPluginHost with the AU already loaded, the assertion does not fail even when uncommented; it looks like there’s only the issue when the AU is added to an already running instance of the AudioPluginHost.

The VST3 version of the plugin appears to work without any issues.

Any idea what might be going on? Please let me know if I should provide any additional information. Thank you!

Are you using the very latest version of JUCE from the develop branch? This sounds like an issue that was fixed recently:

I was using the master version, looks like using the develop version fixed it! Thank you very much for the help, and for your work on JUCE!

That said, there still are two audio outputs (in addition to the midi output) on the audio unit… is that just a quirk of the audio unit format?

If I remember correctly, MIDI AudioUnits require at least one audio bus because the host uses the audio buses to set the current sampling rate on the plugin. This is important when computing the correct sample offsets for MIDI events.

DAWs with MIDI FX support (e.g. Logic) normally don’t provide any way of routing audio to/from MIDI plugins.

That makes sense, thank you!