Browse Source

Added a category support for parameters created with the AudioProcessorValueTree

tags/2021-05-28
hogliux 8 years ago
parent
commit
7399ed8ea8
2 changed files with 11 additions and 5 deletions
  1. +6
    -4
      modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp
  2. +5
    -1
      modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h

+ 6
- 4
modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp View File

@@ -37,8 +37,9 @@ struct AudioProcessorValueTreeState::Parameter : public AudioProcessorParamete
std::function<float (const String&)> textToValue, std::function<float (const String&)> textToValue,
bool meta, bool meta,
bool automatable, bool automatable,
bool discrete)
: AudioProcessorParameterWithID (parameterID, paramName, labelText),
bool discrete,
AudioProcessorParameter::Category category)
: AudioProcessorParameterWithID (parameterID, paramName, labelText, category),
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),
@@ -191,7 +192,8 @@ AudioProcessorParameterWithID* AudioProcessorValueTreeState::createAndAddParamet
std::function<float (const String&)> textToValueFunction, std::function<float (const String&)> textToValueFunction,
bool isMetaParameter, bool isMetaParameter,
bool isAutomatableParameter, bool isAutomatableParameter,
bool isDiscreteParameter)
bool isDiscreteParameter,
AudioProcessorParameter::Category category)
{ {
// 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());
@@ -199,7 +201,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, isAutomatableParameter, isMetaParameter, isAutomatableParameter,
isDiscreteParameter);
isDiscreteParameter, category);
processor.addParameter (p); processor.addParameter (p);
return p; return p;
} }


+ 5
- 1
modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h View File

@@ -80,6 +80,8 @@ public:
@param isAutomatableParameter Set this value to false if this parameter should not be automatable @param isAutomatableParameter Set this value to false if this parameter should not be automatable
@param isDiscrete Set this value to true to make this parameter take discrete values in a host. @param isDiscrete Set this value to true to make this parameter take discrete values in a host.
@see AudioProcessorParameter::isDiscrete @see AudioProcessorParameter::isDiscrete
@param category Which category the parameter should use.
@see AudioProcessorParameter::Category
@returns the parameter object that was created @returns the parameter object that was created
*/ */
@@ -92,7 +94,9 @@ public:
std::function<float (const String&)> textToValueFunction, std::function<float (const String&)> textToValueFunction,
bool isMetaParameter = false, bool isMetaParameter = false,
bool isAutomatableParameter = true, bool isAutomatableParameter = true,
bool isDiscrete = false);
bool isDiscrete = false,
AudioProcessorParameter::Category category
= AudioProcessorParameter::genericParameter);
/** 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;


Loading…
Cancel
Save