1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-20 01:14:20 +00:00

Added a category support for parameters created with the AudioProcessorValueTree

This commit is contained in:
hogliux 2017-11-16 14:52:57 +00:00
parent 94d5ca881c
commit 7399ed8ea8
2 changed files with 11 additions and 5 deletions

View file

@ -37,8 +37,9 @@ struct AudioProcessorValueTreeState::Parameter : public AudioProcessorParamete
std::function<float (const String&)> textToValue,
bool meta,
bool automatable,
bool discrete)
: AudioProcessorParameterWithID (parameterID, paramName, labelText),
bool discrete,
AudioProcessorParameter::Category category)
: AudioProcessorParameterWithID (parameterID, paramName, labelText, category),
owner (s), valueToTextFunction (valueToText), textToValueFunction (textToValue),
range (r), value (defaultVal), defaultValue (defaultVal),
listenersNeedCalling (true),
@ -191,7 +192,8 @@ AudioProcessorParameterWithID* AudioProcessorValueTreeState::createAndAddParamet
std::function<float (const String&)> textToValueFunction,
bool isMetaParameter,
bool isAutomatableParameter,
bool isDiscreteParameter)
bool isDiscreteParameter,
AudioProcessorParameter::Category category)
{
// All parameters must be created before giving this manager a ValueTree state!
jassert (! state.isValid());
@ -199,7 +201,7 @@ AudioProcessorParameterWithID* AudioProcessorValueTreeState::createAndAddParamet
Parameter* p = new Parameter (*this, paramID, paramName, labelText, r,
defaultVal, valueToTextFunction, textToValueFunction,
isMetaParameter, isAutomatableParameter,
isDiscreteParameter);
isDiscreteParameter, category);
processor.addParameter (p);
return p;
}

View file

@ -80,6 +80,8 @@ public:
@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.
@see AudioProcessorParameter::isDiscrete
@param category Which category the parameter should use.
@see AudioProcessorParameter::Category
@returns the parameter object that was created
*/
@ -92,7 +94,9 @@ public:
std::function<float (const String&)> textToValueFunction,
bool isMetaParameter = false,
bool isAutomatableParameter = true,
bool isDiscrete = false);
bool isDiscrete = false,
AudioProcessorParameter::Category category
= AudioProcessorParameter::genericParameter);
/** Returns a parameter by its ID string. */
AudioProcessorParameterWithID* getParameter (StringRef parameterID) const noexcept;