AudioUnitPluginFormat: AudioUnitRender crashes when encountering buffer with zero channels (disabled bus)

Hi. I’m experiencing crashes when configuring bus layouts with disableNonMainBuses. I’ve tested this in the latest AudioPluginHost adding disableNonMainBuses immediately after enableAllBuses is called in PluginGraph::addPluginCallback. I experienced the crashes for EZDrummer and iDrum, both which have numerous output buses enabled by default.

The crash occurs in processAudio in the call to AudioUnitRender (line 1093). I believe it has something to do with having zero channels for the buffer. Some random hacking suggested that the setting of the stream format in syncBusLayouts also should be aware of the zero channel situation. I found avoiding setting the format to help “make it work” but I’m not sure that would be considered correct. I also ended up changing outputBufferList to contain a pairing of the bus index with the associated AUBuffer and only generate them when channels are available.

This is with latest develop on Catelina 10.15.6 with Xcode 12.4