Browse Source

Always use maximum amount of channels for VST2 plugins

Fixes #1184
Fixes #1106

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
e645376663
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 37 additions and 6 deletions
  1. +15
    -1
      source/backend/plugin/CarlaPluginJuce.cpp
  2. +1
    -1
      source/backend/utils/CachedPlugins.cpp
  3. +21
    -4
      source/discovery/carla-discovery.cpp

+ 15
- 1
source/backend/plugin/CarlaPluginJuce.cpp View File

@@ -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<uint32_t>(std::max(fInstance->getTotalNumOutputChannels(), 0));
params = static_cast<uint32_t>(std::max(fInstance->getNumParameters(), 0));

if (getType() == PLUGIN_VST2)
{
if (VstEffectInterface* const vst
= reinterpret_cast<VstEffectInterface*>(fInstance->getPlatformSpecificData()))
{
aIns = std::max(aIns, static_cast<uint32_t>(std::max(vst->numInputChannels, 0)));
aOuts = std::max(aOuts, static_cast<uint32_t>(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<int>(aIns), static_cast<int>(aOuts), pData->engine->getSampleRate(), static_cast<int>(pData->engine->getBufferSize()));
fInstance->setPlayConfigDetails(static_cast<int>(aIns),
static_cast<int>(aOuts),
pData->engine->getSampleRate(),
static_cast<int>(pData->engine->getBufferSize()));

bufferSizeChanged(pData->engine->getBufferSize());
reloadPrograms(true);


+ 1
- 1
source/backend/utils/CachedPlugins.cpp View File

@@ -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;


+ 21
- 4
source/discovery/carla-discovery.cpp View File

@@ -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 <Foundation/Foundation.h>
@@ -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<VstEffectInterface*>(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())
{


Loading…
Cancel
Save