From 2f59cc5ec6b8e35cdffd2d073d412b4827c47326 Mon Sep 17 00:00:00 2001 From: Felix Homann Date: Thu, 7 Apr 2022 10:31:04 +0200 Subject: [PATCH] Use buses API for channel configuration Without configuration the plugin would expose a multitude of input and output channels, at least when used in Carla. The projucer's pluginChannelConfigs option cannot be carried over to the cmake build system so, following [1], channel configuration is done using the buses API . [1] https://github.com/juce-framework/JUCE/blob/master/docs/CMake%20API.md --- Source/PluginProcessor.cpp | 8 +++++++- Source/PluginProcessor.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 977795a3..fe13fda5 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -63,7 +63,8 @@ #endif //============================================================================== -DexedAudioProcessor::DexedAudioProcessor() { +DexedAudioProcessor::DexedAudioProcessor() + : AudioProcessor(BusesProperties().withOutput("output", AudioChannelSet::stereo(), true)) { #ifdef DEBUG // avoid creating the log file if it is in standalone mode @@ -723,6 +724,11 @@ bool DexedAudioProcessor::isOutputChannelStereoPair (int index) const { return true; } +bool DexedAudioProcessor::isBusesLayoutSupported(const BusesLayout &layouts) const { + return layouts.getMainOutputChannelSet() == AudioChannelSet::mono() + || layouts.getMainOutputChannelSet() == AudioChannelSet::stereo(); +} + bool DexedAudioProcessor::acceptsMidi() const { return true; } diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 6bbbebbf..83de86a4 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -213,6 +213,7 @@ public : const String getOutputChannelName (int channelIndex) const; bool isInputChannelStereoPair (int index) const; bool isOutputChannelStereoPair (int index) const; + bool isBusesLayoutSupported (const BusesLayout& layouts) const; bool acceptsMidi() const; bool producesMidi() const;