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_AudioProcessorParameter.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
29class AudioProcessor;
30
31//==============================================================================
40{
41public:
42 AudioProcessorParameter() noexcept = default;
43
92 explicit AudioProcessorParameter (int versionHint)
93 : version (versionHint) {}
94
97
106 virtual float getValue() const = 0;
107
122 virtual void setValue (float newValue) = 0;
123
134 void setValueNotifyingHost (float newValue);
135
142 void beginChangeGesture();
143
149 void endChangeGesture();
150
152 virtual float getDefaultValue() const = 0;
153
157 virtual String getName (int maximumStringLength) const = 0;
158
162 virtual String getLabel() const = 0;
163
177 virtual int getNumSteps() const;
178
188 virtual bool isDiscrete() const;
189
200 virtual bool isBoolean() const;
201
207 virtual String getText (float normalisedValue, int /*maximumStringLength*/) const;
208
210 virtual float getValueForText (const String& text) const = 0;
211
216 virtual bool isOrientationInverted() const;
217
221 virtual bool isAutomatable() const;
222
228 virtual bool isMetaParameter() const;
229
231 {
232 genericParameter = (0 << 16) | 0,
234 inputGain = (1 << 16) | 0,
235 outputGain = (1 << 16) | 1,
236
242 inputMeter = (2 << 16) | 0,
243 outputMeter = (2 << 16) | 1,
244 compressorLimiterGainReductionMeter = (2 << 16) | 2,
245 expanderGateGainReductionMeter = (2 << 16) | 3,
246 analysisMeter = (2 << 16) | 4,
247 otherMeter = (2 << 16) | 5
248 };
249
251 virtual Category getCategory() const;
252
254 int getParameterIndex() const noexcept { return parameterIndex; }
255
256 //==============================================================================
266 virtual String getCurrentValueAsText() const;
267
276 virtual StringArray getAllValueStrings() const;
277
278 //==============================================================================
280 int getVersionHint() const { return version; }
281
282 //==============================================================================
293 class JUCE_API Listener
294 {
295 public:
297 virtual ~Listener() = default;
298
308 virtual void parameterValueChanged (int parameterIndex, float newValue) = 0;
309
323 virtual void parameterGestureChanged (int parameterIndex, bool gestureIsStarting) = 0;
324 };
325
331 void addListener (Listener* newListener);
332
337 void removeListener (Listener* listener);
338
339 //==============================================================================
341 void sendValueChangedMessageToListeners (float newValue);
342
343private:
344 //==============================================================================
345 friend class AudioProcessor;
346 friend class LegacyAudioParameter;
347 AudioProcessor* processor = nullptr;
348 int parameterIndex = -1;
349 int version = 0;
350 CriticalSection listenerLock;
351 Array<Listener*> listeners;
352 mutable StringArray valueStrings;
353
354 #if JUCE_DEBUG
355 bool isPerformingGesture = false;
356 #endif
357
359};
360
361} // namespace juce
Holds a resizable array of primitive or copy-by-value objects.
Definition juce_Array.h:56
A base class for listeners that want to know about changes to an AudioProcessorParameter.
virtual ~Listener()=default
Destructor.
virtual void parameterValueChanged(int parameterIndex, float newValue)=0
Receives a callback when a parameter has been changed.
virtual void parameterGestureChanged(int parameterIndex, bool gestureIsStarting)=0
Indicates that a parameter change gesture has started.
An abstract base class for parameter objects that can be added to an AudioProcessor.
virtual float getValue() const =0
Called by the host to find out the value of this parameter.
virtual String getLabel() const =0
Some parameters may be able to return a label string for their units.
virtual float getDefaultValue() const =0
This should return the default value for this parameter.
virtual void setValue(float newValue)=0
The host will call this method to change the value of a parameter.
AudioProcessorParameter(int versionHint)
The version hint supplied to this constructor is used in Audio Unit plugins to aid ordering parameter...
int getParameterIndex() const noexcept
Returns the index of this parameter in its parent processor's parameter list.
virtual float getValueForText(const String &text) const =0
Should parse a string and return the appropriate value for it.
virtual String getName(int maximumStringLength) const =0
Returns the name to display for this parameter, which should be made to fit within the given string l...
Base class for audio processing classes or plugins.
A special array for holding a list of strings.
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 ...
JUCE Namespace.