82 bool discrete =
false,
boolean =
false;
125 template <
typename It>
126 using ValidIfIterator =
decltype (
std::next (std::declval<It>()));
130 template <
typename... Items>
133 template <
typename It,
typename = Val
idIfIterator<It>>
136 template <
typename... Items>
139 parameters.reserve (parameters.size() +
sizeof... (items));
140 (parameters.push_back (makeParameterStorage (std::move (items))), ...);
143 template <
typename It,
typename = Val
idIfIterator<It>>
144 void add (It begin, It end)
150 [] (
auto item) {
return makeParameterStorage (std::move (item)); });
165 virtual ~Visitor() =
default;
175 struct ParameterStorageBase
177 virtual ~ParameterStorageBase() =
default;
178 virtual void accept (
const Visitor& visitor) = 0;
181 template <
typename Contents>
182 struct ParameterStorage : ParameterStorageBase
186 void accept (
const Visitor& visitor)
override { visitor.visit (std::move (contents)); }
191 template <
typename Contents>
194 return std::make_unique<ParameterStorage<Contents>> (std::move (contents));
306 [[deprecated (
"This function is deprecated and will be removed in a future version of JUCE! "
307 "See the method docs for a code example of the replacement methods.")]]
309 const String& parameterName,
315 bool isMetaParameter =
false,
316 bool isAutomatableParameter =
true,
317 bool isDiscrete =
false,
319 bool isBoolean =
false);
395 void replaceState (
const ValueTree& newState);
472 const String& parameterName,
477 [[deprecated (
"Prefer the signature taking an Attributes argument")]]
479 const String& parameterName,
482 float defaultParameterValue,
485 bool isMetaParameter =
false,
486 bool isAutomatableParameter =
true,
487 bool isDiscrete =
false,
489 bool isBoolean =
false)
493 defaultParameterValue,
495 .withStringFromValueFunction (adaptSignature (std::move (valueToTextFunction)))
496 .withValueFromStringFunction (std::move (textToValueFunction))
497 .withMeta (isMetaParameter)
498 .withAutomatable (isAutomatableParameter)
499 .withDiscrete (isDiscrete)
500 .withCategory (parameterCategory)
501 .withBoolean (isBoolean))
505 float getDefaultValue()
const override;
506 int getNumSteps()
const override;
508 bool isDiscrete()
const override;
509 bool isBoolean()
const override;
517 return [f = std::move (func)] (
float v,
int) {
return f (v); };
524 const float unsnappedDefault;
525 const bool discrete, boolean;
544 const String& parameterID,
570 const String& parameterID,
591 const String& parameterID,
622 [[deprecated (
"This method was introduced to allow you to use AudioProcessorValueTreeState parameters in "
623 "an AudioProcessorParameterGroup, but there is now a much nicer way to achieve this. See the "
624 "method docs for a code example.")]]
631 friend struct ParameterAdapterTests;
637 bool flushParameterValuesToValueTree();
639 void timerCallback()
override;
643 void valueTreeRedirected (
ValueTree&)
override;
644 void updateParameterConnectionsToChildTrees();
646 const Identifier valueType {
"PARAM" }, valuePropertyID {
"value" }, idPropertyID {
"id" };
648 struct StringRefLessThan final
650 bool operator() (StringRef a, StringRef b)
const noexcept {
return a.text.compare (b.text) < 0; }
655 CriticalSection valueTreeChanging;
T back_inserter(T... args)
Properties of an AudioParameterFloat.
A subclass of AudioProcessorParameter that provides an easy way to create a parameter which maps onto...
Advanced properties of an AudioProcessorValueTreeState::Parameter.
auto withLabel(String x) const
const auto & getDiscrete() const
auto withDiscrete(bool x) const
Pass 'true' if this parameter has discrete steps, or 'false' if the parameter is continuous.
const auto & getAudioParameterFloatAttributes() const
auto withMeta(bool x) const
const auto & getBoolean() const
auto withAutomatable(bool x) const
auto withValueFromStringFunction(ValueFromString x) const
auto withCategory(Category x) const
auto withStringFromValueFunction(StringFromValue x) const
auto withInverted(bool x) const
auto withBoolean(bool x) const
Pass 'true' if this parameter only has two valid states.
An object of this class maintains a connection between a ComboBox and a parameter in an AudioProcesso...
A class to contain a set of RangedAudioParameters and AudioProcessorParameterGroups containing Ranged...
A parameter class that maintains backwards compatibility with deprecated AudioProcessorValueTreeState...
An object of this class maintains a connection between a Slider and a parameter in an AudioProcessorV...
This class contains a ValueTree that is used to manage an AudioProcessor's entire state.
UndoManager *const undoManager
Provides access to the undo manager that this object is using.
AudioProcessor & processor
A reference to the processor with which this state is associated.
ValueTree state
The state of the whole processor.
Base class for audio processing classes or plugins.
A component that lets the user choose from a drop-down list of choices.
Represents a string identifier, designed for accessing properties by name.
Represents a mapping between an arbitrary range of values and a normalised 0->1 range.
Combines a parameter ID and a version hint.
auto withValueFromStringFunction(ValueFromString x) const
An optional lambda function that parses a string and converts it into a non-normalised value.
auto withMeta(bool x) const
See AudioProcessorParameter::isMetaParameter()
auto withCategory(Category x) const
See AudioProcessorParameterWithIDAttributes::withCategory()
auto withAutomatable(bool x) const
See AudioProcessorParameter::isAutomatable()
auto withStringFromValueFunction(StringFromValue x) const
An optional lambda function that converts a non-normalised value to a string with a maximum length.
auto withInverted(bool x) const
See AudioProcessorParameter::isOrientationInverted()
auto withLabel(String x) const
See AudioProcessorParameterWithIDAttributes::withLabel()
This abstract base class is used by some AudioProcessorParameter helper classes.
A slider control for changing a value.
A simple class for holding temporary references to a string literal or String.
Makes repeated callbacks to a virtual method at a specified time interval.
Manages a list of undo/redo commands.
Listener class for events that happen to a ValueTree.
A powerful tree structure that can be used to hold free-form data, and which can handle its own undo ...
Represents a shared variant value.
T make_move_iterator(T... args)
@ valueChanged
Indicates that the UI element's value has changed.
Object withMember(Object copy, Member OtherObject::*member, Other &&value)
Copies an object, sets one of the copy's members to the specified value, and then returns the copy.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
A listener class that can be attached to an AudioProcessorValueTreeState.
virtual void parameterChanged(const String ¶meterID, float newValue)=0
This callback method is called by the AudioProcessorValueTreeState when a parameter changes.