LMMS
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
33class AudioParameterFloatAttributes : public RangedAudioParameterAttributes<AudioParameterFloatAttributes, float> {};
34
35//==============================================================================
45{
46public:
65 AudioParameterFloat (const ParameterID& parameterID,
66 const String& parameterName,
67 NormalisableRange<float> normalisableRange,
68 float defaultValue,
69 const AudioParameterFloatAttributes& attributes = {});
70
86 [[deprecated ("Prefer the signature taking an Attributes argument")]]
87 AudioParameterFloat (const ParameterID& parameterID,
88 const String& parameterName,
89 NormalisableRange<float> normalisableRange,
90 float defaultValue,
91 const String& parameterLabel,
93 std::function<String (float value, int maximumStringLength)> stringFromValue = nullptr,
94 std::function<float (const String& text)> valueFromString = nullptr)
95 : AudioParameterFloat (parameterID,
96 parameterName,
97 std::move (normalisableRange),
98 defaultValue,
99 AudioParameterFloatAttributes().withLabel (parameterLabel)
100 .withCategory (parameterCategory)
101 .withStringFromValueFunction (std::move (stringFromValue))
102 .withValueFromStringFunction (std::move (valueFromString)))
103 {
104 }
105
111 AudioParameterFloat (const ParameterID& parameterID,
112 const String& parameterName,
113 float minValue,
114 float maxValue,
115 float defaultValue);
116
118 ~AudioParameterFloat() override;
119
121 float get() const noexcept { return value; }
122
124 operator float() const noexcept { return value; }
125
127 AudioParameterFloat& operator= (float newValue);
128
130 const NormalisableRange<float>& getNormalisableRange() const override { return range; }
131
134
135protected:
139 virtual void valueChanged (float newValue);
140
141private:
142 //==============================================================================
143 float getValue() const override;
144 void setValue (float newValue) override;
145 float getDefaultValue() const override;
146 int getNumSteps() const override;
147 String getText (float, int) const override;
148 float getValueForText (const String&) const override;
149
150 std::atomic<float> value;
151 const float valueDefault;
152 std::function<String (float, int)> stringFromValueFunction;
153 std::function<float (const String&)> valueFromStringFunction;
154
156};
157
158} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_AudioParameterFloat.h:33
Definition juce_AudioParameterFloat.h:45
float get() const noexcept
Definition juce_AudioParameterFloat.h:121
int getNumSteps() const override
Definition juce_AudioParameterFloat.cpp:91
AudioParameterFloat(const ParameterID &parameterID, const String &parameterName, NormalisableRange< float > normalisableRange, float defaultValue, const AudioParameterFloatAttributes &attributes={})
Definition juce_AudioParameterFloat.cpp:29
std::function< String(float, int)> stringFromValueFunction
Definition juce_AudioParameterFloat.h:152
virtual void valueChanged(float newValue)
Definition juce_AudioParameterFloat.cpp:94
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)
Definition juce_AudioParameterFloat.h:87
const NormalisableRange< float > & getNormalisableRange() const override
Definition juce_AudioParameterFloat.h:130
float getDefaultValue() const override
Definition juce_AudioParameterFloat.cpp:90
const float valueDefault
Definition juce_AudioParameterFloat.h:151
std::function< float(const String &)> valueFromStringFunction
Definition juce_AudioParameterFloat.h:153
void setValue(float newValue) override
Definition juce_AudioParameterFloat.cpp:89
float getValueForText(const String &) const override
Definition juce_AudioParameterFloat.cpp:93
NormalisableRange< float > range
Definition juce_AudioParameterFloat.h:133
float getValue() const override
Definition juce_AudioParameterFloat.cpp:88
String getText(float, int) const override
Definition juce_AudioParameterFloat.cpp:92
std::atomic< float > value
Definition juce_AudioParameterFloat.h:150
Category
Definition juce_AudioProcessorParameter.h:231
@ genericParameter
Definition juce_AudioProcessorParameter.h:232
Definition juce_NormalisableRange.h:40
Definition juce_AudioProcessorParameterWithID.h:33
Definition juce_RangedAudioParameter.h:42
Definition juce_RangedAudioParameter.h:98
Definition juce_String.h:53
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
Definition juce_Uuid.h:141
const char * text
Definition swell-functions.h:167
#define const
Definition zconf.h:137