1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-22 01:34:21 +00:00

Choose stereo layout as default layout when using legacy channel configuration field

This commit is contained in:
hogliux 2016-02-16 09:11:22 +00:00
parent 3aa68f3d00
commit d0d9b9c181

View file

@ -42,36 +42,25 @@ AudioProcessor::AudioProcessor()
nonRealtime (false),
processingPrecision (singlePrecision)
{
#if ! JucePlugin_IsMidiEffect
#ifdef JucePlugin_PreferredChannelConfigurations
const short channelConfigs[][2] = { JucePlugin_PreferredChannelConfigurations };
#else
const short channelConfigs[][2] = { {2, 2} };
#endif
int numChannelConfigs = sizeof (channelConfigs) / sizeof (*channelConfigs);
if (numChannelConfigs > 0)
{
int defaultLayoutIdx = 0;
#if ! JucePlugin_IsMidiEffect
#if ! JucePlugin_IsSynth
busArrangement.inputBuses.add (AudioProcessorBus ("Input", AudioChannelSet::canonicalChannelSet (channelConfigs[0][0])));
#endif
busArrangement.outputBuses.add (AudioProcessorBus ("Output", AudioChannelSet::canonicalChannelSet (channelConfigs[0][1])));
// prefer stereo if available
for (int i = 0; i < numChannelConfigs; ++i)
{
if (channelConfigs[i][0] == 2 || channelConfigs[i][1] == 2)
{
defaultLayoutIdx = i;
break;
}
}
#if ! JucePlugin_IsSynth
busArrangement.inputBuses.add (AudioProcessorBus ("Input", AudioChannelSet::canonicalChannelSet (channelConfigs[defaultLayoutIdx][0])));
#endif
busArrangement.outputBuses.add (AudioProcessorBus ("Output", AudioChannelSet::canonicalChannelSet (channelConfigs[defaultLayoutIdx][1])));
}
#ifdef JucePlugin_PreferredChannelConfigurations
#if ! JucePlugin_IsSynth
AudioProcessor::setPreferredBusArrangement (true, 0, AudioChannelSet::stereo());
#endif
AudioProcessor::setPreferredBusArrangement (false, 0, AudioChannelSet::stereo());
#endif
#endif
updateSpeakerFormatStrings();
}