From d0d9b9c18162011fd914240e841b3aaa8f5c41b2 Mon Sep 17 00:00:00 2001 From: hogliux Date: Tue, 16 Feb 2016 09:11:22 +0000 Subject: [PATCH] Choose stereo layout as default layout when using legacy channel configuration field --- .../processors/juce_AudioProcessor.cpp | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp index a777cb2e75..90ee65c89a 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp @@ -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(); }