PluginInstance hits assertion error for channel number


I’m trying to load an instrument as a PluginInstance which I can use to send midi data from within my audio plugin. Looking through the forum posts, I found how I can create the instance:

PluginDescription desc;
desc.pluginFormatName = “AudioUnit”;
desc.fileOrIdentifier = “AudioUnit:Synths/aumu,dls ,appl”;

AudioPluginFormatManager formatManager;
String errorString;
pluginInstance = formatManager.createPluginInstance(desc, getSampleRate(), getBlockSize(), errorString);

Then in my processBlock() method I call pluginInstance->processBlock(audioBuffer, midiBuffer); but for some reason that triggers an assertion error on line 275 of juce_AudioSampleBuffer.h because channelNumber >= numChannels. After doing a little debugging I see that numChannels is 2 but channelNumber goes from 0 - 3 (4 total). I’m not sure how I’m hitting this assertion, my plugin has 0 input channels and 16 output channels and changing that number has no effect…

I’m sure I’m missing something but I can’t figure out how to get past this… Does anyone have any advice on how to use a pluginInstance in an audio plugin?