diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.h b/modules/juce_audio_processors/processors/juce_AudioProcessor.h index 66fb89d9fe..e9e13618c1 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.h +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.h @@ -1119,7 +1119,7 @@ public: NOTE! This method will eventually be deprecated! It's recommended that you use AudioProcessorParameter::isMetaParameter() instead. - */ + */ 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 diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorParameter.h b/modules/juce_audio_processors/processors/juce_AudioProcessorParameter.h index 3abccb795a..4d4be65814 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessorParameter.h +++ b/modules/juce_audio_processors/processors/juce_AudioProcessorParameter.h @@ -152,9 +152,10 @@ public: outputGain = (1 << 16) | 1, /** 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, outputMeter = (2 << 16) | 1, compressorLimiterGainReductionMeter = (2 << 16) | 2, diff --git a/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp b/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp index 4c7fb00547..d5540cac7d 100644 --- a/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp +++ b/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp @@ -33,12 +33,14 @@ struct AudioProcessorValueTreeState::Parameter : public AudioProcessorParamete NormalisableRange r, float defaultVal, std::function valueToText, std::function textToValue, - bool meta) + bool meta, + bool automatable) : AudioProcessorParameterWithID (parameterID, paramName, labelText), owner (s), valueToTextFunction (valueToText), textToValueFunction (textToValue), range (r), value (defaultVal), defaultValue (defaultVal), listenersNeedCalling (true), - isMeta (meta) + isMetaParam (meta), + isAutomatableParam (automatable) { state.addListener (this); needsUpdate.set (1); @@ -146,7 +148,8 @@ struct AudioProcessorValueTreeState::Parameter : public AudioProcessorParamete return nullptr; } - bool isMetaParameter() const override { return isMeta; } + bool isMetaParameter() const override { return isMetaParam; } + bool isAutomatable() const override { return isAutomatableParam; } AudioProcessorValueTreeState& owner; ValueTree state; @@ -157,7 +160,7 @@ struct AudioProcessorValueTreeState::Parameter : public AudioProcessorParamete float value, defaultValue; Atomic needsUpdate; bool listenersNeedCalling; - bool isMeta; + const bool isMetaParam, isAutomatableParam; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Parameter) }; @@ -181,7 +184,8 @@ AudioProcessorParameterWithID* AudioProcessorValueTreeState::createAndAddParamet const String& labelText, NormalisableRange r, float defaultVal, std::function valueToTextFunction, std::function textToValueFunction, - bool isMetaParameter) + bool isMetaParameter, + bool isAutomatableParameter) { // All parameters must be created before giving this manager a ValueTree state! jassert (! state.isValid()); @@ -191,7 +195,7 @@ AudioProcessorParameterWithID* AudioProcessorValueTreeState::createAndAddParamet Parameter* p = new Parameter (*this, paramID, paramName, labelText, r, defaultVal, valueToTextFunction, textToValueFunction, - isMetaParameter); + isMetaParameter, isAutomatableParameter); processor.addParameter (p); return p; } diff --git a/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h b/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h index b3a129fef3..aa276b470d 100644 --- a/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h +++ b/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h @@ -66,16 +66,18 @@ public: Calling this will create and add a special type of AudioProcessorParameter to the 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 */ AudioProcessorParameterWithID* createAndAddParameter (const String& parameterID, @@ -85,7 +87,8 @@ public: float defaultValue, std::function valueToTextFunction, std::function textToValueFunction, - bool isMetaParameter = false); + bool isMetaParameter = false, + bool isAutomatableParameter = true); /** Returns a parameter by its ID string. */ AudioProcessorParameterWithID* getParameter (StringRef parameterID) const noexcept;