34 value (
def ? 1.0f : 0.0f),
36 stringFromBoolFunction (attributes.getStringFromValueFunction() !=
nullptr
37 ? attributes.getStringFromValueFunction()
39 boolFromStringFunction (attributes.getValueFromStringFunction() !=
nullptr
40 ? attributes.getValueFromStringFunction()
44 static const StringArray offStrings {
TRANS (
"off"),
TRANS (
"no"),
TRANS (
"false") };
56 return text.getIntValue() != 0;
63 #if __cpp_lib_atomic_is_always_lock_free
65 "AudioParameterBool requires a lock-free std::atomic<float>");
69float AudioParameterBool::getValue()
const {
return value; }
70void AudioParameterBool::setValue (
float newValue) { value = newValue;
valueChanged (
get()); }
71float AudioParameterBool::getDefaultValue()
const {
return valueDefault; }
72int AudioParameterBool::getNumSteps()
const {
return 2; }
73bool AudioParameterBool::isDiscrete()
const {
return true; }
74bool AudioParameterBool::isBoolean()
const {
return true; }
77float AudioParameterBool::getValueForText (
const String& text)
const
79 return boolFromStringFunction (text) ? 1.0f : 0.0f;
82String AudioParameterBool::getText (
float v,
int maximumLength)
const
89 if (
get() != newValue)
Properties of an AudioParameterBool.
Provides a class of AudioProcessorParameter that can be used as a boolean value.
bool get() const noexcept
Returns the parameter's current boolean value.
AudioParameterBool & operator=(bool newValue)
Changes the parameter's current value to a new boolean.
virtual void valueChanged(bool newValue)
Override this method if you are interested in receiving callbacks when the parameter value changes.
AudioParameterBool(const ParameterID ¶meterID, const String ¶meterName, bool defaultValue, const AudioParameterBoolAttributes &attributes={})
Creates a AudioParameterBool with the specified parameters.
~AudioParameterBool() override
Destructor.
void setValueNotifyingHost(float newValue)
A processor should call this when it needs to change one of its parameters.
Combines a parameter ID and a version hint.
This abstract base class is used by some AudioProcessorParameter helper classes.
A special array for holding a list of strings.
#define TRANS(stringLiteral)
Uses the LocalisedStrings class to translate the given string literal.
@ valueChanged
Indicates that the UI element's value has changed.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...