Multi Bus AU Plugin

I’m writing a multibus plugin that will have a strict 8in - 8out bus layout. Everything works fine under VST, but AU has issues.

Here’s the relevant code snippets.

// PluginProcessor.cpp
#define JucePlugin_MaxNumInputChannels              8
#define JucePlugin_MaxNumOutputChannels             8
#define JucePlugin_PreferredChannelConfigurations   {8, 8}

#define MAX_OUTS 8

// PluginProcessor.cpp
AudioPluginAudioProcessor::AudioPluginAudioProcessor()
: AudioProcessor(
    BusesProperties()
        .withInput("Input #1", juce::AudioChannelSet::stereo(), true)
        .withInput("Input #2", juce::AudioChannelSet::stereo(), true)
        .withInput("Input #3", juce::AudioChannelSet::stereo(), true)
        .withInput("Input #4", juce::AudioChannelSet::stereo(), true)
        .withInput("Input #5", juce::AudioChannelSet::stereo(), true)
        .withInput("Input #6", juce::AudioChannelSet::stereo(), true)
        .withInput("Input #7", juce::AudioChannelSet::stereo(), true)
        .withInput("Input #8", juce::AudioChannelSet::stereo(), true)
        .withOutput("Output #1", juce::AudioChannelSet::stereo(), true)
        .withOutput("Output #2", juce::AudioChannelSet::stereo(), true)
        .withOutput("Output #3", juce::AudioChannelSet::stereo(), true)
        .withOutput("Output #4", juce::AudioChannelSet::stereo(), true)
        .withOutput("Output #5", juce::AudioChannelSet::stereo(), true)
        .withOutput("Output #6", juce::AudioChannelSet::stereo(), true)
        .withOutput("Output #7", juce::AudioChannelSet::stereo(), true)
        .withOutput("Output #8", juce::AudioChannelSet::stereo(), true)
)
{
    // constructor stuff
}

bool AudioPluginAudioProcessor::isBusesLayoutSupported(
    const BusesLayout& layouts) const
{
    const int numInputs = layouts.getMainInputChannels();
    const int numOutputs = layouts.getMainOutputChannels();

    return numInputs == MAX_OUTS && numOutputs == MAX_OUTS;
}

With the code as above, auval reports

Reported Channel Capabilities (explicit):
      [2, 2]  [8, 8]
.....
ERROR: -10868 IN CALL Cannot Set Input Num Channels:2 when unit says it can
ca_require: ValidFormat(inScope, inElement, newDesc) InvalidFormat /Users/beserge/Development/plugin/lib/JUCE/modules/juce_audio_plugin_client/AU/CoreAudioUtilityClasses/AUBase.cpp:871

ERROR: Cannot verify Audio Channel Layouts as Format handling has problems

(Where does it get the idea that [2,2] should work?)

If I always return true in isBusesLayoutSupported, then we pass validation, but crash during the Render Tests.

If I get rid of isBusesLayoutSupported entirely, we pass auval with [0,-1] as the supposed configuration, but then Logic only allows the plugin to start as Stereo or Dual Mono, both of which a.) are not what I want, and b.) cause the plugin to crash.

I’ve tried the canAddBus canRemoveBus overrides as well, but I don’t want dynamic busses, so I just had them return false. Doesn’t seem to help.

Lmk if you have any suggestions or questions, and thanks for the help!

Edit: As I understand it I want 8 IO busses, with 2 channels each (i.e. Stereo Layout, which is what I configured above). Should I check layouts.inputBuses.size() == MAX_OUTS? I tried that as well but it doesn’t work.

auval reports [-1,-2] and crashes on the Render Test.

1 Like

I think you have a few issues here:

  1. Never use JucePlugin_PreferredChannelConfigurations, JucePlugin_MaxNumInputChannels and/or JucePlugin_MaxNumOutputChannels if you plan on having more than one input/output bus. Your plug-in will not work properly. Those defines are legacy and should really not be used in new code regardless the number of buses. Make sure that these fields are also not set in the Projucer (the default on any new audio plug-in project).

  2. I think you may be confusing channels and busses.

Reported Channel Capabilities (explicit):
          [2, 2]     [8, 8]

auval only tests the number of channels it can set on the main busses (i.e. the first input/output bus). It thinks that [2,2] should work as you are initialising the main busses with a stereo layout in the constructor of your processor. Hence, stereo must be supported. It’s likely getting the [8, 8] from your JucePlugin_PreferredChannelConfigurations definition which is a (legacy) list of the number of channels that are supported on the main busses only.

If you only want stereo on your busses then your isBusesLayoutSupported implementation should iterate through every bus and check if it’s either stereo or disabled. It’s important to check that it can be disabled because some DAWs will not support multiple input buses and so the DAW will attempt to disable individual buses.

bool isBusesLayoutSupported (const BusesLayout& layout) const override
{
    return std::all_of (layout.inputBuses.begin(), layout.inputBuses.end(), [] (const auto& bus)
           {
               return bus.isDisabled() || bus == AudioChannelSet::stereo();
           })
        && std::all_of (layout.outputBuses.begin(), layout.outputBuses.end(), [] (const auto& bus)
           {
               return bus.isDisabled() || bus == AudioChannelSet::stereo();
           });
}
  1. Multi-bus support in DAWs is limited to only a very limited number of well-known bus/channel layouts. For example, Logic supports the following configurations:
    a. Single input/single output bus (effect, midi controlled effect)
    b. Single output bus (instrument)
    c. Two input busses (main and sidechain)/ single output bus (effect, midi controlled effect)
    d. 16 output busses (first bus can have any layout, all other busses must either all be mono or all be stereo) (instruments)

ProTools has similar restrictions but additionally restricts the sidechain to be mono only.

So even if your plug-in technically supports some bus/channel layout configuration doesn’t mean that the DAW will support it (in fact, it likely won’t support it).

1 Like

@fr810 Thanks so much for the detailed reply!

On points 1 and 2, the code side of the issue is fixed. AU passes and the plugin works correctly under Ableton at least.

On point 3, I can confirm it doesn’t show up in Logic (and likely won’t in Pro Tools either).
I developed the plugin mostly in Ableton, which works well (with the AU now as well!)
What other DAWs will work with this bus layout I wonder?

Anyways, thanks for the help!

I’m not really sure to be honest. I’ve only regularly tested Logic Pro, Ableton and Pro Tools - and this was a long time ago. Does anybody else on the forum have more experiences with this here?