@@ -1119,7 +1119,7 @@ public: | |||||
NOTE! This method will eventually be deprecated! It's recommended that you use | NOTE! This method will eventually be deprecated! It's recommended that you use | ||||
AudioProcessorParameter::isMetaParameter() instead. | AudioProcessorParameter::isMetaParameter() instead. | ||||
*/ | |||||
*/ | |||||
virtual AudioProcessorParameter::Category getParameterCategory (int parameterIndex) const; | virtual AudioProcessorParameter::Category getParameterCategory (int parameterIndex) const; | ||||
/** Sends a signal to the host to tell it that the user is about to start changing this | /** Sends a signal to the host to tell it that the user is about to start changing this | ||||
@@ -152,9 +152,10 @@ public: | |||||
outputGain = (1 << 16) | 1, | outputGain = (1 << 16) | 1, | ||||
/** The following categories tell the host that this parameter is a meter level value | /** The following categories tell the host that this parameter is a meter level value | ||||
and therefore read-only. Most hosts will display these type of parameters as | |||||
a meter in the generic view of your plug-in. Pro-Tools will also show the meter | |||||
in the mixer view. */ | |||||
and therefore read-only. Most hosts will display these type of parameters as | |||||
a meter in the generic view of your plug-in. Pro-Tools will also show the meter | |||||
in the mixer view. | |||||
*/ | |||||
inputMeter = (2 << 16) | 0, | inputMeter = (2 << 16) | 0, | ||||
outputMeter = (2 << 16) | 1, | outputMeter = (2 << 16) | 1, | ||||
compressorLimiterGainReductionMeter = (2 << 16) | 2, | compressorLimiterGainReductionMeter = (2 << 16) | 2, | ||||
@@ -33,12 +33,14 @@ struct AudioProcessorValueTreeState::Parameter : public AudioProcessorParamete | |||||
NormalisableRange<float> r, float defaultVal, | NormalisableRange<float> r, float defaultVal, | ||||
std::function<String (float)> valueToText, | std::function<String (float)> valueToText, | ||||
std::function<float (const String&)> textToValue, | std::function<float (const String&)> textToValue, | ||||
bool meta) | |||||
bool meta, | |||||
bool automatable) | |||||
: AudioProcessorParameterWithID (parameterID, paramName, labelText), | : AudioProcessorParameterWithID (parameterID, paramName, labelText), | ||||
owner (s), valueToTextFunction (valueToText), textToValueFunction (textToValue), | owner (s), valueToTextFunction (valueToText), textToValueFunction (textToValue), | ||||
range (r), value (defaultVal), defaultValue (defaultVal), | range (r), value (defaultVal), defaultValue (defaultVal), | ||||
listenersNeedCalling (true), | listenersNeedCalling (true), | ||||
isMeta (meta) | |||||
isMetaParam (meta), | |||||
isAutomatableParam (automatable) | |||||
{ | { | ||||
state.addListener (this); | state.addListener (this); | ||||
needsUpdate.set (1); | needsUpdate.set (1); | ||||
@@ -146,7 +148,8 @@ struct AudioProcessorValueTreeState::Parameter : public AudioProcessorParamete | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
bool isMetaParameter() const override { return isMeta; } | |||||
bool isMetaParameter() const override { return isMetaParam; } | |||||
bool isAutomatable() const override { return isAutomatableParam; } | |||||
AudioProcessorValueTreeState& owner; | AudioProcessorValueTreeState& owner; | ||||
ValueTree state; | ValueTree state; | ||||
@@ -157,7 +160,7 @@ struct AudioProcessorValueTreeState::Parameter : public AudioProcessorParamete | |||||
float value, defaultValue; | float value, defaultValue; | ||||
Atomic<int> needsUpdate; | Atomic<int> needsUpdate; | ||||
bool listenersNeedCalling; | bool listenersNeedCalling; | ||||
bool isMeta; | |||||
const bool isMetaParam, isAutomatableParam; | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Parameter) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Parameter) | ||||
}; | }; | ||||
@@ -181,7 +184,8 @@ AudioProcessorParameterWithID* AudioProcessorValueTreeState::createAndAddParamet | |||||
const String& labelText, NormalisableRange<float> r, | const String& labelText, NormalisableRange<float> r, | ||||
float defaultVal, std::function<String (float)> valueToTextFunction, | float defaultVal, std::function<String (float)> valueToTextFunction, | ||||
std::function<float (const String&)> textToValueFunction, | std::function<float (const String&)> textToValueFunction, | ||||
bool isMetaParameter) | |||||
bool isMetaParameter, | |||||
bool isAutomatableParameter) | |||||
{ | { | ||||
// All parameters must be created before giving this manager a ValueTree state! | // All parameters must be created before giving this manager a ValueTree state! | ||||
jassert (! state.isValid()); | jassert (! state.isValid()); | ||||
@@ -191,7 +195,7 @@ AudioProcessorParameterWithID* AudioProcessorValueTreeState::createAndAddParamet | |||||
Parameter* p = new Parameter (*this, paramID, paramName, labelText, r, | Parameter* p = new Parameter (*this, paramID, paramName, labelText, r, | ||||
defaultVal, valueToTextFunction, textToValueFunction, | defaultVal, valueToTextFunction, textToValueFunction, | ||||
isMetaParameter); | |||||
isMetaParameter, isAutomatableParameter); | |||||
processor.addParameter (p); | processor.addParameter (p); | ||||
return p; | return p; | ||||
} | } | ||||
@@ -66,16 +66,18 @@ public: | |||||
Calling this will create and add a special type of AudioProcessorParameter to the | Calling this will create and add a special type of AudioProcessorParameter to the | ||||
AudioProcessor to which this state is attached. | AudioProcessor to which this state is attached. | ||||
@param parameterID A unique string ID for the new parameter | |||||
@param parameterName The name that the parameter will return from AudioProcessorParameter::getName() | |||||
@param labelText The label that the parameter will return from AudioProcessorParameter::getLabel() | |||||
@param valueRange A mapping that will be used to determine the value range which this parameter uses | |||||
@param defaultValue A default value for the parameter (in non-normalised units) | |||||
@param valueToTextFunction A function that will convert a non-normalised value to a string for the | |||||
AudioProcessorParameter::getText() method. This can be nullptr to use the | |||||
default implementation | |||||
@param textToValueFunction The inverse of valueToTextFunction | |||||
@param isMetaParameter Set this value to true if this should be a meta parameter | |||||
@param parameterID A unique string ID for the new parameter | |||||
@param parameterName The name that the parameter will return from AudioProcessorParameter::getName() | |||||
@param labelText The label that the parameter will return from AudioProcessorParameter::getLabel() | |||||
@param valueRange A mapping that will be used to determine the value range which this parameter uses | |||||
@param defaultValue A default value for the parameter (in non-normalised units) | |||||
@param valueToTextFunction A function that will convert a non-normalised value to a string for the | |||||
AudioProcessorParameter::getText() method. This can be nullptr to use the | |||||
default implementation | |||||
@param textToValueFunction The inverse of valueToTextFunction | |||||
@param isMetaParameter Set this value to true if this should be a meta parameter | |||||
@param isAutomatableParameter Set this value to false if this parameter should not be automatable | |||||
@returns the parameter object that was created | @returns the parameter object that was created | ||||
*/ | */ | ||||
AudioProcessorParameterWithID* createAndAddParameter (const String& parameterID, | AudioProcessorParameterWithID* createAndAddParameter (const String& parameterID, | ||||
@@ -85,7 +87,8 @@ public: | |||||
float defaultValue, | float defaultValue, | ||||
std::function<String (float)> valueToTextFunction, | std::function<String (float)> valueToTextFunction, | ||||
std::function<float (const String&)> textToValueFunction, | std::function<float (const String&)> textToValueFunction, | ||||
bool isMetaParameter = false); | |||||
bool isMetaParameter = false, | |||||
bool isAutomatableParameter = true); | |||||
/** Returns a parameter by its ID string. */ | /** Returns a parameter by its ID string. */ | ||||
AudioProcessorParameterWithID* getParameter (StringRef parameterID) const noexcept; | AudioProcessorParameterWithID* getParameter (StringRef parameterID) const noexcept; | ||||