LMMS
Loading...
Searching...
No Matches
juce_AudioParameterInt.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 AudioParameterIntAttributes : public RangedAudioParameterAttributes<AudioParameterIntAttributes, int> {};
34
35//==============================================================================
45{
46public:
66 AudioParameterInt (const ParameterID& parameterID,
67 const String& parameterName,
68 int minValue,
69 int maxValue,
70 int defaultValue,
71 const AudioParameterIntAttributes& attributes = {});
72
88 [[deprecated ("Prefer the signature taking an Attributes argument")]]
89 AudioParameterInt (const ParameterID& parameterID,
90 const String& parameterName,
91 int minValue,
92 int maxValue,
93 int defaultValueIn,
94 const String& parameterLabel,
95 std::function<String (int value, int maximumStringLength)> stringFromInt = nullptr,
96 std::function<int (const String& text)> intFromString = nullptr)
97 : AudioParameterInt (parameterID,
98 parameterName,
99 minValue,
100 maxValue,
101 defaultValueIn,
102 AudioParameterIntAttributes().withLabel (parameterLabel)
103 .withStringFromValueFunction (std::move (stringFromInt))
104 .withValueFromStringFunction (std::move (intFromString)))
105 {
106 }
107
109 ~AudioParameterInt() override;
110
112 int get() const noexcept { return roundToInt (value.load()); }
113
115 operator int() const noexcept { return get(); }
116
120 AudioParameterInt& operator= (int newValue);
121
124
126 const NormalisableRange<float>& getNormalisableRange() const override { return range; }
127
128protected:
132 virtual void valueChanged (int newValue);
133
134private:
135 //==============================================================================
136 float getValue() const override;
137 void setValue (float newValue) override;
138 float getDefaultValue() const override;
139 int getNumSteps() const override;
140 String getText (float, int) const override;
141 float getValueForText (const String&) const override;
142
144 std::atomic<float> value;
145 const float defaultValue;
146 std::function<String (int, int)> stringFromIntFunction;
147 std::function<int (const String&)> intFromStringFunction;
148
150};
151
152} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_AudioParameterInt.h:33
Definition juce_AudioParameterInt.h:45
AudioParameterInt(const ParameterID &parameterID, const String &parameterName, int minValue, int maxValue, int defaultValue, const AudioParameterIntAttributes &attributes={})
Definition juce_AudioParameterInt.cpp:29
int get() const noexcept
Definition juce_AudioParameterInt.h:112
AudioParameterInt(const ParameterID &parameterID, const String &parameterName, int minValue, int maxValue, int defaultValueIn, const String &parameterLabel, std::function< String(int value, int maximumStringLength)> stringFromInt=nullptr, std::function< int(const String &text)> intFromString=nullptr)
Definition juce_AudioParameterInt.h:89
std::function< String(int, int)> stringFromIntFunction
Definition juce_AudioParameterInt.h:146
std::function< int(const String &)> intFromStringFunction
Definition juce_AudioParameterInt.h:147
const NormalisableRange< float > & getNormalisableRange() const override
Definition juce_AudioParameterInt.h:126
std::atomic< float > value
Definition juce_AudioParameterInt.h:144
const float defaultValue
Definition juce_AudioParameterInt.h:145
Range< int > getRange() const noexcept
Definition juce_AudioParameterInt.h:123
const NormalisableRange< float > range
Definition juce_AudioParameterInt.h:143
Definition juce_NormalisableRange.h:40
Definition juce_AudioProcessorParameterWithID.h:33
Definition juce_Range.h:40
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
@ valueChanged
Definition juce_AccessibilityEvent.h:44
int roundToInt(const FloatType value) noexcept
Definition juce_MathsFunctions.h:465
Definition juce_Uuid.h:141
const char * text
Definition swell-functions.h:167
typedef int(UZ_EXP MsgFn)()
#define const
Definition zconf.h:137