Hi friends,
I’m working on a plugin that has the following requirements:
-
Needs audio input – bus can be any layout because the plugin needs one mono input and internally makes sure to read only one channel at a time
-
Always outputs a stereo signal
-
Also needs MIDI input – because of this, I need to implement a sidechain possibility for Logic users to be able to route MIDI & audio into the same VST
In my constructor, I’m initializing AudioProcessor with a makeBusProperties()
function like so:
MyAudioProcessor::MyAudioProcessor(): AudioProcessor(makeBusProperties())
This function seems to work alright, but I’m trying to figure out how to write my isBusesLayoutSupported()
function correctly.
Here’s my makeBusProperties() function:
AudioProcessor::BusesProperties MyAudioProcessor::makeBusProperties()
{
if(host.isLogic() || host.isGarageBand())
return BusesProperties().withInput ("Input", AudioChannelSet::mono(), true)
.withInput ("Sidechain", AudioChannelSet::mono(), true)
.withOutput("Output", AudioChannelSet::stereo(), true);
return BusesProperties().withInput ("Input", AudioChannelSet::mono(), true)
.withOutput("Output", AudioChannelSet::stereo(), true);
};
and here’s the isBusesLayoutSupported() I have so far:
bool MyAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const
{
if ( layouts.getMainInputChannelSet() == juce::AudioChannelSet::disabled()
|| layouts.getMainOutputChannelSet() == juce::AudioChannelSet::disabled() )
return false;
if (layouts.getMainOutputChannelSet() != juce::AudioChannelSet::stereo())
return false;
if (host.isLogic() || host.isGarageBand() )
// make sure that sidechain input is not disabled... [1]
// but how to retrieve the sidechain bus from layouts ?
return true;
};
the line of code I’d love to be able to write at [1] is
if (layouts.getSidechainChannelSet() == juce::AudioChannelSet::disabled())
return false;
but I’m a bit perplexed at how retrieving various buses other than the main ins/outs from a BusesLayout is supposed to work.
Per the documentation, you can call getChannelSet(isInput, busIndex)
– but I don’t understand how you’re supposed to know what the integer busIndex
is for the bus you want to examine, considering that buses are created/initialized using a string identifier and not an integer index…
Why can’t you just retrieve a bus using its string identifier…?
Is there something I’m missing here?