Browse Source

VST and VST3: Removed the caching of hosted parameter information

tags/2021-05-28
Tom Poole 7 years ago
parent
commit
5a701fc385
2 changed files with 21 additions and 37 deletions
  1. +12
    -34
      modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp
  2. +9
    -3
      modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp

+ 12
- 34
modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp View File

@@ -1700,20 +1700,10 @@ struct VST3PluginInstance : public AudioPluginInstance
{ {
VST3Parameter (VST3PluginInstance& parent, VST3Parameter (VST3PluginInstance& parent,
Steinberg::Vst::ParamID parameterID, Steinberg::Vst::ParamID parameterID,
const String& parameterName,
const String& parameterLabel,
Steinberg::Vst::ParamValue defaultParameterValue,
bool parameterIsAutomatable,
bool parameterIsDiscrete,
int numParameterSteps)
bool parameterIsAutomatable)
: pluginInstance (parent), : pluginInstance (parent),
paramID (parameterID), paramID (parameterID),
name (parameterName),
label (parameterLabel),
defaultValue (defaultParameterValue),
automatable (parameterIsAutomatable),
discrete (parameterIsDiscrete),
numSteps (numParameterSteps)
automatable (parameterIsAutomatable)
{ {
} }
@@ -1767,17 +1757,17 @@ struct VST3PluginInstance : public AudioPluginInstance
float getDefaultValue() const override float getDefaultValue() const override
{ {
return (float) defaultValue;
return (float) pluginInstance.getParameterInfoForIndex (getParameterIndex()).defaultNormalizedValue;
} }
String getName (int /*maximumStringLength*/) const override String getName (int /*maximumStringLength*/) const override
{ {
return name;
return toString (pluginInstance.getParameterInfoForIndex (getParameterIndex()).title);
} }
String getLabel() const override String getLabel() const override
{ {
return label;
return toString (pluginInstance.getParameterInfoForIndex (getParameterIndex()).units);
} }
bool isAutomatable() const override bool isAutomatable() const override
@@ -1787,12 +1777,14 @@ struct VST3PluginInstance : public AudioPluginInstance
bool isDiscrete() const override bool isDiscrete() const override
{ {
return discrete;
return getNumSteps() != AudioProcessor::getDefaultNumParameterSteps();
} }
int getNumSteps() const override int getNumSteps() const override
{ {
return numSteps;
auto stepCount = pluginInstance.getParameterInfoForIndex (getParameterIndex()).stepCount;
return stepCount == 0 ? AudioProcessor::getDefaultNumParameterSteps()
: stepCount + 1;
} }
StringArray getAllValueStrings() const override StringArray getAllValueStrings() const override
@@ -1802,10 +1794,7 @@ struct VST3PluginInstance : public AudioPluginInstance
VST3PluginInstance& pluginInstance; VST3PluginInstance& pluginInstance;
const Steinberg::Vst::ParamID paramID; const Steinberg::Vst::ParamID paramID;
const String name, label;
const Steinberg::Vst::ParamValue defaultValue;
const bool automatable, discrete;
const int numSteps;
const bool automatable;
}; };
VST3PluginInstance (VST3ComponentHolder* componentHolder) VST3PluginInstance (VST3ComponentHolder* componentHolder)
@@ -1878,21 +1867,10 @@ struct VST3PluginInstance : public AudioPluginInstance
for (int i = 0; i < editController->getParameterCount(); ++i) for (int i = 0; i < editController->getParameterCount(); ++i)
{ {
Vst::ParameterInfo paramInfo = { 0 };
editController->getParameterInfo (i, paramInfo);
bool isDiscrete = paramInfo.stepCount != 0;
int numSteps = isDiscrete ? paramInfo.stepCount + 1
: AudioProcessor::getDefaultNumParameterSteps();
auto paramInfo = getParameterInfoForIndex (i);
VST3Parameter* p = new VST3Parameter (*this, VST3Parameter* p = new VST3Parameter (*this,
paramInfo.id, paramInfo.id,
toString (paramInfo.title),
toString (paramInfo.units),
paramInfo.defaultNormalizedValue,
(paramInfo.flags & Vst::ParameterInfo::kCanAutomate) != 0,
isDiscrete,
numSteps);
(paramInfo.flags & Vst::ParameterInfo::kCanAutomate) != 0);
addParameter (p); addParameter (p);
if ((paramInfo.flags & Vst::ParameterInfo::kIsBypass) != 0) if ((paramInfo.flags & Vst::ParameterInfo::kIsBypass) != 0)


+ 9
- 3
modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp View File

@@ -916,6 +916,10 @@ struct VSTPluginInstance : public AudioPluginInstance,
String getName (int maximumStringLength) const override String getName (int maximumStringLength) const override
{ {
if (name.isEmpty())
return pluginInstance.getTextForOpcode (getParameterIndex(),
plugInOpcodeGetParameterName);
if (name.length() <= maximumStringLength) if (name.length() <= maximumStringLength)
return name; return name;
@@ -933,7 +937,9 @@ struct VSTPluginInstance : public AudioPluginInstance,
String getLabel() const override String getLabel() const override
{ {
return label;
return label.isEmpty() ? pluginInstance.getTextForOpcode (getParameterIndex(),
plugInOpcodeGetParameterLabel)
: label;
} }
bool isAutomatable() const override bool isAutomatable() const override
@@ -989,10 +995,10 @@ struct VSTPluginInstance : public AudioPluginInstance,
for (int i = 0; i < vstEffect->numParameters; ++i) for (int i = 0; i < vstEffect->numParameters; ++i)
{ {
String paramName (getTextForOpcode (i, plugInOpcodeGetParameterName));
String paramName;
Array<String> shortParamNames; Array<String> shortParamNames;
float defaultValue = 0; float defaultValue = 0;
String label (getTextForOpcode (i, plugInOpcodeGetParameterLabel));
String label;
bool isAutomatable = dispatch (plugInOpcodeIsParameterAutomatable, i, 0, 0, 0) != 0; bool isAutomatable = dispatch (plugInOpcodeIsParameterAutomatable, i, 0, 0, 0) != 0;
bool isDiscrete = false; bool isDiscrete = false;
int numSteps = AudioProcessor::getDefaultNumParameterSteps(); int numSteps = AudioProcessor::getDefaultNumParameterSteps();


Loading…
Cancel
Save