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_ParameterAttachments.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
47 private AsyncUpdater
48{
49public:
62 UndoManager* undoManager = nullptr);
63
65 ~ParameterAttachment() override;
66
74 void sendInitialUpdate();
75
82
88 void beginGesture();
89
96
102 void endGesture();
103
104private:
105 float normalise (float f) const { return parameter.convertTo0to1 (f); }
106
107 template <typename Callback>
108 void callIfParameterValueChanged (float newDenormalisedValue, Callback&& callback);
109
110 void parameterValueChanged (int, float) override;
111 void parameterGestureChanged (int, bool) override {}
112 void handleAsyncUpdate() override;
113
114 RangedAudioParameter& parameter;
115 std::atomic<float> lastValue { 0.0f };
116 UndoManager* undoManager = nullptr;
117 std::function<void (float)> setValue;
118
120};
121
122//==============================================================================
134{
135public:
143 UndoManager* undoManager = nullptr);
144
147
151 void sendInitialUpdate();
152
153private:
154 void setValue (float newValue);
155 void sliderValueChanged (Slider*) override;
156
157 void sliderDragStarted (Slider*) override { attachment.beginGesture(); }
158 void sliderDragEnded (Slider*) override { attachment.endGesture(); }
159
160 Slider& slider;
161 ParameterAttachment attachment;
162 bool ignoreCallbacks = false;
163};
164
165//==============================================================================
182{
183public:
191 UndoManager* undoManager = nullptr);
192
195
199 void sendInitialUpdate();
200
201private:
202 void setValue (float newValue);
203 void comboBoxChanged (ComboBox*) override;
204
205 ComboBox& comboBox;
206 RangedAudioParameter& storedParameter;
207 ParameterAttachment attachment;
208 bool ignoreCallbacks = false;
209};
210
211//==============================================================================
223{
224public:
232 UndoManager* undoManager = nullptr);
233
236
240 void sendInitialUpdate();
241
242private:
243 void setValue (float newValue);
244 void buttonClicked (Button*) override;
245
246 Button& button;
247 ParameterAttachment attachment;
248 bool ignoreCallbacks = false;
249};
250
251} // namespace juce
Has a callback method that is triggered asynchronously.
A base class for listeners that want to know about changes to an AudioProcessorParameter.
An object of this class maintains a connection between a Button and a plug-in parameter.
void sendInitialUpdate()
Call this after setting up your button in the case where you need to do extra setup after constructin...
Used to receive callbacks when a button is clicked.
A base class for buttons.
Definition juce_Button.h:43
An object of this class maintains a connection between a ComboBox and a plug-in parameter.
void sendInitialUpdate()
Call this after setting up your combo box in the case where you need to do extra setup after construc...
A class for receiving events from a ComboBox.
A component that lets the user choose from a drop-down list of choices.
Used to implement 'attachments' or 'controllers' that link a plug-in parameter to a UI element.
void endGesture()
Ends a gesture on the managed parameter.
void setValueAsCompleteGesture(float newDenormalisedValue)
Triggers a full gesture message on the managed parameter.
void sendInitialUpdate()
Calls the parameterChangedCallback function that was registered in the constructor,...
void beginGesture()
Begins a gesture on the managed parameter.
void setValueAsPartOfGesture(float newDenormalisedValue)
Updates the parameter value during a gesture.
~ParameterAttachment() override
Destructor.
This abstract base class is used by some AudioProcessorParameter helper classes.
float convertTo0to1(float v) const noexcept
Normalises and snaps a value based on the normalisable range.
An object of this class maintains a connection between a Slider and a plug-in parameter.
void sendInitialUpdate()
Call this after setting up your slider in the case where you need to do extra setup after constructin...
A class for receiving callbacks from a Slider.
A slider control for changing a value.
Definition juce_Slider.h:54
Manages a list of undo/redo commands.
#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.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88