From f15d61d059dfcd1106781aa2e55563e868f44887 Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Fri, 6 Oct 2023 17:28:43 +0100 Subject: [PATCH] Impl DAW channel count UI changes in DS plugin --- .../src/direct_speakers_frontend_connector.cpp | 3 ++- .../src/direct_speakers_plugin_processor.cpp | 8 ++++++-- .../src/direct_speakers_plugin_processor.hpp | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_frontend_connector.cpp b/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_frontend_connector.cpp index e5706ffef..fac02a63b 100644 --- a/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_frontend_connector.cpp +++ b/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_frontend_connector.cpp @@ -188,7 +188,8 @@ void DirectSpeakersJuceFrontendConnector::setSpeakerSetup( routingComboBoxLocked->clearEntries(); auto layoutSizeFixed = layoutSize != 0 ? layoutSize - 1 : layoutSize; for (int i = 1; i + layoutSizeFixed <= MAX_DAW_CHANNELS; ++i) { - routingComboBoxLocked->addTextEntry(routingLayoutDescriptionAt(i, layoutSizeFixed)); + auto entry = routingComboBoxLocked->addTextEntry(routingLayoutDescriptionAt(i, layoutSizeFixed), i); + entry->setSelectable(i + layoutSizeFixed <= p_->getNumDawChannels()); } routingComboBoxLocked->selectEntry(cachedRouting_, sendNotification); } diff --git a/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_plugin_processor.cpp b/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_plugin_processor.cpp index 29156308d..a4faa6e77 100644 --- a/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_plugin_processor.cpp +++ b/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_plugin_processor.cpp @@ -5,8 +5,6 @@ #include "direct_speakers_plugin_editor.hpp" #include "direct_speakers_frontend_connector.hpp" -#include - void registerPluginLoadSig(std::function); uint32_t requestInputInstanceIdSig(); @@ -213,6 +211,12 @@ void DirectSpeakersAudioProcessor::setIHostApplication(Steinberg::FUnknown * unk this->extensionSetState(xmlState); }); } + + auto getAppVersionPtr = reaperHost->getReaperApi("GetAppVersion"); + numDawChannels_ = MAX_DAW_CHANNELS; + if (getAppVersionPtr) { + numDawChannels_ = GetReaperChannelCount(getAppVersionPtr); + } } } diff --git a/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_plugin_processor.hpp b/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_plugin_processor.hpp index 0c67d507e..d5b49fce5 100644 --- a/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_plugin_processor.hpp +++ b/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_plugin_processor.hpp @@ -6,6 +6,7 @@ #include "components/level_meter_calculator.hpp" #include "reaper_vst3_interfaces.h" #include "components/read_only_audio_parameter_int.hpp" +#include #include @@ -72,6 +73,8 @@ class DirectSpeakersAudioProcessor : public AudioProcessor, public VST3ClientExt void setIHostApplication(Steinberg::FUnknown *unknown) override; void extensionSetState(std::string const& xmlState); + int getNumDawChannels() { return numDawChannels_; } + private: IReaperHostApplication* reaperHost{ nullptr }; ear::plugin::communication::ConnectionId connectionId_; @@ -87,6 +90,7 @@ class DirectSpeakersAudioProcessor : public AudioProcessor, public VST3ClientExt std::unique_ptr backend_; int samplerate_; + int numDawChannels_{MAX_DAW_CHANNELS}; std::shared_ptr levelMeter_; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DirectSpeakersAudioProcessor)