Hi everybody,
so I have a question about multi bus processing for an AU (VST also) sample player using Juce (5.4.7).
I’ve already searched in the Juce forum but can`t find an answer (may be that I just don’t understand…)
I have a AU synth (almost) perfectly running.
It sets up 8 stereo buses for output using the code snippets that you can see below.
The plug in validates fine and when opening the plug-in in Logic I can select between
- Stereo and
- Multi-Output “8x Stereo”
which is in fact what I want (those 2 options). Everything fine until here.
At startup, the constructor of my AudioProcessor calls addBuses().
At this stage I’d like to see wheather the DAW tries to run a “Stereo” or a “Multi-Output 8xStereo” version of the plug-in, so I can set up the busses accordingly to the selection that I’ve made in the DAW. And it’s for a good reason because 1 bus cheaper to process than 8, right ?
Is this possible at all ?
While being in the constructor of SimpleSamplerComponentAudioProcessor (and in addBuses() ) i can’t see from where I could obtain this information.
May be that I am missing something here but i think the options that gives me the DAW (Stereo / Multi 8xStereo) must be good for something … ?
Thanks for any thoughts…
Cheers
Rudi
===================================================================
Code snippets:
( Everything still in an experimental stage…)
( note: MAX_NR_OF_OUPUTBUSSES is 8)
SimpleSamplerComponentAudioProcessor::SimpleSamplerComponentAudioProcessor()
: AudioProcessor(addBuses())
{
// do things
}
static BusesProperties addBuses()
{
BusesProperties buses;
for (int i = 0; i < MAX_NR_OF_OUPUTBUSSES; i++) {
std::stringstream busName;
busName << "Output #" << (i + 1);
bool activeByDefault = ((i == 0 ) || i == (MAX_NR_OF_OUPUTBUSSES - 1));
buses = buses.withOutput(busName.str(), AudioChannelSet::stereo(), activeByDefault);
}
return buses;
};
bool SimpleSamplerComponentAudioProcessor::isBusesLayoutSupported(const BusesLayout& layouts) const
{
if (layouts.getMainInputChannels() != 0)
return false;
if (layouts.getMainOutputChannels() != 2)
return false;
int nOuts = layouts.outputBuses.size();
if( nOuts != 1 && nOuts != 8) {
return false;
}
for (int i = 1; i < nOuts; i++) {
if (layouts.getNumChannels(false, i) != 2) return false;
}
return true;
}
