Plugin with fixed number of output channels, but non-fixed nb of buses

Hi Fabian, yes I think I have tried all combinations of options between

  • the initial BusProperties layout
  • allowing the canAddBus and canRemoveBus
  • return false for layouts that I do not want in isBusesLayoutSupported or not

So my attempts look like:

// the default layout set in the constructor
BusesProperties defaultBusesProperties() {
  AudioProcessor::BusesProperties b;
  b.addBus(false, "Output", AudioChannelSet::stereo());
  return b;
}

bool isBusesLayoutSupported(const BusesLayout& layouts) const {
  const AudioChannelSet& mainOutput = layouts.getMainOutputChannelSet();
  if (mainOutput.isDisabled()) return false;

  int nch = 0;
  for (int ibus=0; ibus < layouts.outputBuses.size(); ++ibus) {
    int nchb = layouts.getNumChannels(false, ibus);
    if (nchb > 2) return false;
    if (nchb == 0) return false;
    nch += nchb;
  }
  if (nch > 6) return false;
  return true;
}

bool canAddBus(bool is_input) const {
  if (is_input) return false;

  return true; 
}

bool canRemoveBus(bool is_input) const {
  int nbus = getBusCount(is_input);
  return (is_input ? nbus > 0 : nbus > 1);
}

When I do this, after rescanning in Logic Pro X, it always suggest to instanciate the plugin as ‘mono’, ‘stereo’, ‘multi-output (16x mono)’, ‘multi output (1 stereo, 15 mono)’, ‘multi output (8 stereo, 8 mono)’, ‘multi output (16 stereo)’. Moreover, if I attempt to instanciate the plugin in one of these ‘multi-output configurations’, Logic says ‘Failed to load Audio Unit, please contact the manufacturer for an updated version or further assistance.

However , I found out that adding these line at the end of the getAUChannelInfo of juce_AU_Shared.h seems to enforce the number of channels in Logic:

AUChannelInfo info; info.inChannels=0; info.outChannels=-5;
channelInfo.add(info);

Wtih that added, logic now shows ‘mono’, ‘stereo’, ‘multi output (5x mono)’ ‘multi output (1x stereo, 3x mono)’ and ‘multi output (3x stereo)’