JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_AudioParameterFloat.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
35class AudioParameterFloatAttributes : public RangedAudioParameterAttributes<AudioParameterFloatAttributes, float> {};
36
37//==============================================================================
47{
48public:
67 AudioParameterFloat (const ParameterID& parameterID,
68 const String& parameterName,
69 NormalisableRange<float> normalisableRange,
70 float defaultValue,
71 const AudioParameterFloatAttributes& attributes = {});
72
88 [[deprecated ("Prefer the signature taking an Attributes argument")]]
89 AudioParameterFloat (const ParameterID& parameterID,
90 const String& parameterName,
91 NormalisableRange<float> normalisableRange,
92 float defaultValue,
93 const String& parameterLabel,
94 Category parameterCategory = AudioProcessorParameter::genericParameter,
95 std::function<String (float value, int maximumStringLength)> stringFromValue = nullptr,
96 std::function<float (const String& text)> valueFromString = nullptr)
97 : AudioParameterFloat (parameterID,
98 parameterName,
99 std::move (normalisableRange),
100 defaultValue,
101 AudioParameterFloatAttributes().withLabel (parameterLabel)
102 .withCategory (parameterCategory)
103 .withStringFromValueFunction (std::move (stringFromValue))
104 .withValueFromStringFunction (std::move (valueFromString)))
105 {
106 }
107
113 AudioParameterFloat (const ParameterID& parameterID,
114 const String& parameterName,
115 float minValue,
116 float maxValue,
117 float defaultValue);
118
120 ~AudioParameterFloat() override;
121
123 float get() const noexcept { return value; }
124
126 operator float() const noexcept { return value; }
127
129 AudioParameterFloat& operator= (float newValue);
130
132 const NormalisableRange<float>& getNormalisableRange() const override { return range; }
133
136
137protected:
141 virtual void valueChanged (float newValue);
142
143private:
144 //==============================================================================
145 float getValue() const override;
146 void setValue (float newValue) override;
147 float getDefaultValue() const override;
148 int getNumSteps() const override;
149 String getText (float, int) const override;
150 float getValueForText (const String&) const override;
151
152 std::atomic<float> value;
153 const float valueDefault;
154 std::function<String (float, int)> stringFromValueFunction;
155 std::function<float (const String&)> valueFromStringFunction;
156
158};
159
160} // namespace juce
Properties of an AudioParameterFloat.
A subclass of AudioProcessorParameter that provides an easy way to create a parameter which maps onto...
float get() const noexcept
Returns the parameter's current value.
AudioParameterFloat(const ParameterID &parameterID, const String &parameterName, NormalisableRange< float > normalisableRange, float defaultValue, const String &parameterLabel, Category parameterCategory=AudioProcessorParameter::genericParameter, std::function< String(float value, int maximumStringLength)> stringFromValue=nullptr, std::function< float(const String &text)> valueFromString=nullptr)
Creates a AudioParameterFloat with the specified parameters.
const NormalisableRange< float > & getNormalisableRange() const override
Returns the range of values that the parameter can take.
NormalisableRange< float > range
Provides access to the parameter's range.
Represents a mapping between an arbitrary range of values and a normalised 0->1 range.
Combines a parameter ID and a version hint.
This abstract base class is used by some AudioProcessorParameter helper classes.
The JUCE String class!
Definition juce_String.h:53
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
typedef float
JUCE Namespace.
@ valueChanged
Indicates that the UI element's value has changed.