diff --git a/source/backend/plugin/CarlaPluginJuce.cpp b/source/backend/plugin/CarlaPluginJuce.cpp index a950213b4..c8de902be 100644 --- a/source/backend/plugin/CarlaPluginJuce.cpp +++ b/source/backend/plugin/CarlaPluginJuce.cpp @@ -40,6 +40,7 @@ #define JUCE_GUI_BASICS_INCLUDE_XHEADERS 1 #include "AppConfig.h" #include "juce_audio_processors/juce_audio_processors.h" +#include "juce_audio_processors/format_types/juce_VSTInterface.h" #include "juce_gui_basics/juce_gui_basics.h" #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) @@ -477,6 +478,16 @@ public: aOuts = static_cast(std::max(fInstance->getTotalNumOutputChannels(), 0)); params = static_cast(std::max(fInstance->getNumParameters(), 0)); + if (getType() == PLUGIN_VST2) + { + if (VstEffectInterface* const vst + = reinterpret_cast(fInstance->getPlatformSpecificData())) + { + aIns = std::max(aIns, static_cast(std::max(vst->numInputChannels, 0))); + aOuts = std::max(aOuts, static_cast(std::max(vst->numOutputChannels, 0))); + } + } + if (fInstance->acceptsMidi()) { mIns = 1; @@ -672,7 +683,10 @@ public: if (mOuts > 0) pData->extraHints |= PLUGIN_EXTRA_HINT_HAS_MIDI_OUT; - fInstance->setPlayConfigDetails(static_cast(aIns), static_cast(aOuts), pData->engine->getSampleRate(), static_cast(pData->engine->getBufferSize())); + fInstance->setPlayConfigDetails(static_cast(aIns), + static_cast(aOuts), + pData->engine->getSampleRate(), + static_cast(pData->engine->getBufferSize())); bufferSizeChanged(pData->engine->getBufferSize()); reloadPrograms(true); diff --git a/source/backend/utils/CachedPlugins.cpp b/source/backend/utils/CachedPlugins.cpp index 3b6784317..d8aacbf0c 100644 --- a/source/backend/utils/CachedPlugins.cpp +++ b/source/backend/utils/CachedPlugins.cpp @@ -153,7 +153,7 @@ static const CarlaCachedPluginInfo* get_cached_plugin_lv2(Lv2WorldClass& lv2Worl if (char* const bundle = lilv_file_uri_parse(lilvPlugin.get_bundle_uri().as_uri(), nullptr)) { - File fbundle(bundle); + water::File fbundle(bundle); lilv_free(bundle); suri = (fbundle.getFileName() + CARLA_OS_SEP).toRawUTF8() + suri; diff --git a/source/discovery/carla-discovery.cpp b/source/discovery/carla-discovery.cpp index 8fc0bad0f..d64871494 100644 --- a/source/discovery/carla-discovery.cpp +++ b/source/discovery/carla-discovery.cpp @@ -50,7 +50,12 @@ #include "CarlaLadspaUtils.hpp" #include "CarlaLv2Utils.hpp" -#include "CarlaVstUtils.hpp" + +#ifdef USING_JUCE_FOR_VST2 +# include "juce_audio_processors/format_types/juce_VSTInterface.h" +#else +# include "CarlaVstUtils.hpp" +#endif #ifdef CARLA_OS_MAC # import @@ -733,7 +738,7 @@ static void do_lv2_check(const char* const bundle, const bool doInit) const Lilv::Plugins lilvPlugins(lv2World.get_all_plugins()); // Get all plugin URIs in this bundle - StringArray URIs; + water::StringArray URIs; LILV_FOREACH(plugins, it, lilvPlugins) { @@ -1470,6 +1475,18 @@ static void do_juce_check(const char* const filename_, const char* const stype, audioIns = instance->getTotalNumInputChannels(); audioOuts = instance->getTotalNumOutputChannels(); +#if JUCE_PLUGINHOST_VST + if (std::strcmp(stype, "VST2") == 0) + { + if (VstEffectInterface* const vst + = reinterpret_cast(instance->getPlatformSpecificData())) + { + audioIns = std::max(audioIns, std::max(vst->numInputChannels, 0)); + audioOuts = std::max(audioOuts, std::max(vst->numOutputChannels, 0)); + } + } +#endif + parameters = instance->getParameters().size(); if (instance->hasEditor()) @@ -1505,8 +1522,8 @@ static void do_juce_check(const char* const filename_, const char* const stype, static void do_fluidsynth_check(const char* const filename, const PluginType type, const bool doInit) { #ifdef HAVE_FLUIDSYNTH - const water::String jfilename = water::String(CharPointer_UTF8(filename)); - const File file(jfilename); + const water::String jfilename = water::String(water::CharPointer_UTF8(filename)); + const water::File file(jfilename); if (! file.existsAsFile()) {