Browse Source

Fetch/set some extra info for VST3 plugin parameters

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.4.1
falkTX 3 years ago
parent
commit
cac2d62925
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
5 changed files with 72 additions and 23 deletions
  1. +67
    -18
      source/backend/plugin/CarlaPluginJuce.cpp
  2. +1
    -1
      source/backend/plugin/CarlaPluginVST2.cpp
  3. +1
    -1
      source/discovery/carla-discovery.cpp
  4. +2
    -2
      source/plugin/carla-vst.cpp
  5. +1
    -1
      source/utils/JucePluginWindow.hpp

+ 67
- 18
source/backend/plugin/CarlaPluginJuce.cpp View File

@@ -24,7 +24,8 @@
#include "CarlaMathUtils.hpp" #include "CarlaMathUtils.hpp"
#include "CarlaProcessUtils.hpp" #include "CarlaProcessUtils.hpp"
#include "CarlaScopeUtils.hpp" #include "CarlaScopeUtils.hpp"
#include "CarlaVstUtils.hpp"
#include "CarlaVst2Utils.hpp"
#include "CarlaVst3Utils.hpp"


#if defined(__clang__) #if defined(__clang__)
# pragma clang diagnostic push # pragma clang diagnostic push
@@ -561,6 +562,7 @@ public:


const bool isAU = fDesc.pluginFormatName == "AU" || fDesc.pluginFormatName == "AudioUnit"; const bool isAU = fDesc.pluginFormatName == "AU" || fDesc.pluginFormatName == "AudioUnit";
const bool isVST2 = fDesc.pluginFormatName == "VST" || fDesc.pluginFormatName == "VST2"; const bool isVST2 = fDesc.pluginFormatName == "VST" || fDesc.pluginFormatName == "VST2";
const bool isVST3 = fDesc.pluginFormatName == "VST3";
findMaxTotalChannels(fInstance.get(), isAU, aIns, aOuts); findMaxTotalChannels(fInstance.get(), isAU, aIns, aOuts);
fInstance->refreshParameterList(); fInstance->refreshParameterList();


@@ -668,6 +670,7 @@ public:
const float min = 0.0f; const float min = 0.0f;
const float max = 1.0f; const float max = 1.0f;
float def, step, stepSmall, stepLarge; float def, step, stepSmall, stepLarge;
bool hasDetails = false;


if (isVST2) if (isVST2)
{ {
@@ -678,6 +681,8 @@ public:


if (effect != nullptr && effect->dispatcher(effect, effGetParameterProperties, ij, 0, &prop, 0.0f) == 1) if (effect != nullptr && effect->dispatcher(effect, effGetParameterProperties, ij, 0, &prop, 0.0f) == 1)
{ {
hasDetails = true;

/**/ if (prop.flags & kVstParameterIsSwitch) /**/ if (prop.flags & kVstParameterIsSwitch)
{ {
step = max - min; step = max - min;
@@ -710,30 +715,74 @@ public:
if (prop.flags & kVstParameterCanRamp) if (prop.flags & kVstParameterCanRamp)
pData->param.data[j].hints |= PARAMETER_IS_LOGARITHMIC; pData->param.data[j].hints |= PARAMETER_IS_LOGARITHMIC;
} }
}
else if (isVST3)
{
v3_component** const component = (v3_component**)fInstance->getPlatformSpecificData();

v3_edit_controller** controller = nullptr;
v3_cpp_obj_query_interface(component, v3_edit_controller_iid, &controller);

if (controller != nullptr)
{
v3_param_info info;
if (v3_cpp_obj(controller)->get_parameter_info(controller, static_cast<int32_t>(j), &info) == V3_OK)
{
hasDetails = true;

if (info.step_count == 1)
{
step = stepSmall = stepLarge = 1;
pData->param.data[j].hints |= PARAMETER_IS_BOOLEAN;
}
else if (info.step_count != 0)
{
step = 1.0f / static_cast<float>(info.step_count);
stepSmall = step/10.0f;
stepLarge = std::min(1.0f, step*10.0f);
}
else
{
const float range = max - min;
step = range/100.0f;
stepSmall = range/1000.0f;
stepLarge = range/10.0f;
}

if (info.flags & V3_PARAM_READ_ONLY)
pData->param.data[j].type = PARAMETER_OUTPUT;
// TODO V3_PARAM_IS_LIST
if (info.flags & (V3_PARAM_IS_HIDDEN|V3_PARAM_PROGRAM_CHANGE))
pData->param.data[j].hints &= ~PARAMETER_IS_ENABLED;

if ((info.flags & (V3_PARAM_IS_LIST|V3_PARAM_IS_HIDDEN|V3_PARAM_PROGRAM_CHANGE)) == 0x0)
if (info.flags & V3_PARAM_CAN_AUTOMATE)
pData->param.data[j].hints |= PARAMETER_CAN_BE_CV_CONTROLLED;
}

v3_cpp_obj_unref(controller);
}
}

if (! hasDetails)
{
if (parameter->isBoolean())
{
step = max - min;
stepSmall = step;
stepLarge = step;
pData->param.data[j].hints |= PARAMETER_IS_BOOLEAN;
}
else else
{ {
const float range = max - min; const float range = max - min;
step = range/100.0f; step = range/100.0f;
stepSmall = range/1000.0f; stepSmall = range/1000.0f;
stepLarge = range/10.0f; stepLarge = range/10.0f;
}
}
else if (parameter->isBoolean())
{
step = max - min;
stepSmall = step;
stepLarge = step;
pData->param.data[j].hints |= PARAMETER_IS_BOOLEAN;
}
else
{
const float range = max - min;
step = range/100.0f;
stepSmall = range/1000.0f;
stepLarge = range/10.0f;


if (! parameter->isMetaParameter())
pData->param.data[j].hints |= PARAMETER_CAN_BE_CV_CONTROLLED;
if (! parameter->isMetaParameter())
pData->param.data[j].hints |= PARAMETER_CAN_BE_CV_CONTROLLED;
}
} }


def = parameter->getDefaultValue(); def = parameter->getDefaultValue();


+ 1
- 1
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -27,7 +27,7 @@
#include "CarlaMathUtils.hpp" #include "CarlaMathUtils.hpp"
#include "CarlaProcessUtils.hpp" #include "CarlaProcessUtils.hpp"
#include "CarlaScopeUtils.hpp" #include "CarlaScopeUtils.hpp"
#include "CarlaVstUtils.hpp"
#include "CarlaVst2Utils.hpp"


#include "CarlaPluginUI.hpp" #include "CarlaPluginUI.hpp"




+ 1
- 1
source/discovery/carla-discovery.cpp View File

@@ -52,7 +52,7 @@
#include "CarlaLv2Utils.hpp" #include "CarlaLv2Utils.hpp"


#ifndef USING_JUCE_FOR_VST2 #ifndef USING_JUCE_FOR_VST2
# include "CarlaVstUtils.hpp"
# include "CarlaVst2Utils.hpp"
#endif #endif


#ifdef CARLA_OS_MAC #ifdef CARLA_OS_MAC


+ 2
- 2
source/plugin/carla-vst.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla Native Plugins * Carla Native Plugins
* Copyright (C) 2013-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -40,7 +40,7 @@
#include "water/files/File.h" #include "water/files/File.h"


#include "CarlaMathUtils.hpp" #include "CarlaMathUtils.hpp"
#include "CarlaVstUtils.hpp"
#include "CarlaVst2Utils.hpp"


static uint32_t d_lastBufferSize = 0; static uint32_t d_lastBufferSize = 0;
static double d_lastSampleRate = 0.0; static double d_lastSampleRate = 0.0;


+ 1
- 1
source/utils/JucePluginWindow.hpp View File

@@ -19,7 +19,7 @@
#define JUCE_PLUGIN_WINDOW_HPP_INCLUDED #define JUCE_PLUGIN_WINDOW_HPP_INCLUDED


#include "CarlaJuceUtils.hpp" #include "CarlaJuceUtils.hpp"
#include "CarlaVstUtils.hpp"
#include "CarlaVst2Utils.hpp"


#include "AppConfig.h" #include "AppConfig.h"
#include "juce_gui_basics/juce_gui_basics.h" #include "juce_gui_basics/juce_gui_basics.h"


Loading…
Cancel
Save