diff --git a/examples/Plugins/AudioPluginDemo.h b/examples/Plugins/AudioPluginDemo.h index 7205c3255e..d6bc6ac9fe 100644 --- a/examples/Plugins/AudioPluginDemo.h +++ b/examples/Plugins/AudioPluginDemo.h @@ -176,7 +176,7 @@ class JuceDemoPluginAudioProcessor : public AudioProcessor public: //============================================================================== JuceDemoPluginAudioProcessor() - : AudioProcessor (BusesProperties().withOutput ("Output", AudioChannelSet::stereo(), true)), + : AudioProcessor (getBusesProperties()), state (*this, nullptr, "state", { std::make_unique ("gain", "Gain", NormalisableRange (0.0f, 1.0f), 0.9f), std::make_unique ("delay", "Delay Feedback", NormalisableRange (0.0f, 1.0f), 0.5f) }) @@ -194,10 +194,20 @@ public: //============================================================================== bool isBusesLayoutSupported (const BusesLayout& layouts) const override { + // Only mono/stereo and input/output must have same layout const auto& mainOutput = layouts.getMainOutputChannelSet(); + const auto& mainInput = layouts.getMainInputChannelSet(); - // do not allow disabling the main output bus and only allow stereo and mono output - if (mainOutput.isDisabled() || mainOutput.size() > 2) + // input and output layout must either be the same or the input must be disabled altogether + if (! mainInput.isDisabled() && mainInput != mainOutput) + return false; + + // do not allow disabling the main buses + if (mainOutput.isDisabled()) + return false; + + // only allow stereo and mono + if (mainOutput.size() > 2) return false; return true; @@ -623,5 +633,11 @@ private: lastPosInfo.resetToDefault(); } + static BusesProperties getBusesProperties() + { + return BusesProperties().withInput ("Input", AudioChannelSet::stereo(), true) + .withOutput ("Output", AudioChannelSet::stereo(), true); + } + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceDemoPluginAudioProcessor) };