Confused about bus layouts


#1

I’m trying to create a plugin with a side chain input. My main bus should be stereo or mono and my sidechain input should be mono or none.

My code looks like this:

Constructor:

busArrangement.inputBuses.clear();
busArrangement.inputBuses.add ({"Input", AudioChannelSet::stereo()});
busArrangement.inputBuses.add ({"Sidechain", AudioChannelSet::mono()});

busArrangement.outputBuses.clear();
busArrangement.outputBuses.add (AudioProcessorBus ("Output", AudioChannelSet::stereo()));

setPreferredBusArrangement:

const int numChannels = preferredSet.size();

if (busIndex == 0)
{
    // Mono or stereo
    if (numChannels > 2) return false;

    // inputs must equal outputs
    if (! AudioProcessor::setPreferredBusArrangement (! isInputBus, busIndex, preferredSet))
        return false;
}
else if (busIndex == 1)
{
    // Sidechain must be mono
    if (numChannels > 1) return false;
}

return AudioProcessor::setPreferredBusArrangement (isInputBus, busIndex, preferredSet);

Is this correct?

In my host I’m getting an assert:

// the processor may not support this arrangement at all
jassert (newNumIns == getTotalNumInputChannels() && newNumOuts == getTotalNumOutputChannels());

juce_AudioProcessor.cpp: 133
getTotalNumInputChannels() is 2, newNumIns is 3


#2

I am interested in the response to this as well, I’ll be developing a similar plug-in very soon.

I think @fabian is the right person to answer this.

Also, it may be useful if you tell which platform and host application you are witnessing this on


#3

Hi G-Mon,

This looks correct to me. Can you be a bit more specific on how you host this plug-in? BTW: just so you don’t end up writing things twice. We will be releasing a new pre-release version of the multibus API by the end of this week. The API will be backward compatible for any pre 4.1 JUCE plug-in, but any multibus stuff will need some tweaks and re-writes. Specifically, the whole setPreferredBusArrangement stuff will become much much easier. It might be better to hold development on this for a few days. Sorry!

Fabian


#4

Saving a bottle for that event :champagne: