From 0ebb8d86b2729e0ce24b15c2bfd942bf0e9e15d4 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 14 May 2020 01:55:27 +0100 Subject: [PATCH] Fix for some juce-based plugins having 0 audio ports Closes #1084 Signed-off-by: falkTX --- source/backend/plugin/CarlaPluginJuce.cpp | 7 ++++--- source/discovery/carla-discovery.cpp | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/backend/plugin/CarlaPluginJuce.cpp b/source/backend/plugin/CarlaPluginJuce.cpp index 69e444687..cb1d67595 100644 --- a/source/backend/plugin/CarlaPluginJuce.cpp +++ b/source/backend/plugin/CarlaPluginJuce.cpp @@ -438,6 +438,7 @@ public: clearBuffers(); + fInstance->enableAllBuses(); fInstance->refreshParameterList(); uint32_t aIns, aOuts, mIns, mOuts, params; @@ -446,9 +447,9 @@ public: bool needsCtrlIn, needsCtrlOut; needsCtrlIn = needsCtrlOut = false; - aIns = (fInstance->getTotalNumInputChannels() > 0) ? static_cast(fInstance->getTotalNumInputChannels()) : 0; - aOuts = (fInstance->getTotalNumOutputChannels() > 0) ? static_cast(fInstance->getTotalNumOutputChannels()) : 0; - params = (fInstance->getNumParameters() > 0) ? static_cast(fInstance->getNumParameters()) : 0; + aIns = std::max(fInstance->getTotalNumInputChannels(), 0); + aOuts = std::max(fInstance->getTotalNumOutputChannels(), 0); + params = std::max(fInstance->getNumParameters(), 0); if (fInstance->acceptsMidi()) { diff --git a/source/discovery/carla-discovery.cpp b/source/discovery/carla-discovery.cpp index e55aa4399..f11443903 100644 --- a/source/discovery/carla-discovery.cpp +++ b/source/discovery/carla-discovery.cpp @@ -1457,8 +1457,12 @@ static void do_juce_check(const char* const filename_, const char* const stype, { carla_juce_idle(); + instance->enableAllBuses(); instance->refreshParameterList(); + audioIns = instance->getTotalNumInputChannels(); + audioOuts = instance->getTotalNumOutputChannels(); + parameters = instance->getParameters().size(); if (instance->hasEditor())