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_GenericAudioProcessorEditor.cpp
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
31 private Timer
32{
33public:
35 : processor (proc), parameter (param), isLegacyParam (LegacyAudioParameter::isLegacy (&param))
36 {
37 if (isLegacyParam)
38 processor.addListener (this);
39 else
40 parameter.addListener (this);
41
42 startTimer (100);
43 }
44
45 ~ParameterListener() override
46 {
47 if (isLegacyParam)
48 processor.removeListener (this);
49 else
50 parameter.removeListener (this);
51 }
52
53 AudioProcessorParameter& getParameter() const noexcept
54 {
55 return parameter;
56 }
57
58 virtual void handleNewParameterValue() = 0;
59
60private:
61 //==============================================================================
62 void parameterValueChanged (int, float) override
63 {
64 parameterValueHasChanged = 1;
65 }
66
67 void parameterGestureChanged (int, bool) override {}
68
69 //==============================================================================
70 void audioProcessorParameterChanged (AudioProcessor*, int index, float) override
71 {
72 if (index == parameter.getParameterIndex())
73 parameterValueHasChanged = 1;
74 }
75
76 void audioProcessorChanged (AudioProcessor*, const ChangeDetails&) override {}
77
78 //==============================================================================
79 void timerCallback() override
80 {
81 if (parameterValueHasChanged.compareAndSetBool (0, 1))
82 {
83 handleNewParameterValue();
84 startTimerHz (50);
85 }
86 else
87 {
88 startTimer (jmin (250, getTimerInterval() + 10));
89 }
90 }
91
92 AudioProcessor& processor;
93 AudioProcessorParameter& parameter;
94 Atomic<int> parameterValueHasChanged { 0 };
95 const bool isLegacyParam;
96
98};
99
101 public ParameterListener
102{
103public:
104 using ParameterListener::ParameterListener;
105
107};
108
109//==============================================================================
111{
112public:
114 : ParameterComponent (proc, param)
115 {
116 // Set the initial value.
117 handleNewParameterValue();
118
119 button.onClick = [this] { buttonClicked(); };
120
121 addAndMakeVisible (button);
122 }
123
124 void paint (Graphics&) override {}
125
126 void resized() override
127 {
128 auto area = getLocalBounds();
129 area.removeFromLeft (8);
130 button.setBounds (area.reduced (0, 10));
131 }
132
133 void handleNewParameterValue() override
134 {
135 button.setToggleState (isParameterOn(), dontSendNotification);
136 }
137
138private:
139 void buttonClicked()
140 {
141 if (isParameterOn() != button.getToggleState())
142 {
143 getParameter().beginChangeGesture();
144 getParameter().setValueNotifyingHost (button.getToggleState() ? 1.0f : 0.0f);
145 getParameter().endChangeGesture();
146 }
147 }
148
149 bool isParameterOn() const { return getParameter().getValue() >= 0.5f; }
150
151 ToggleButton button;
152
153 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BooleanParameterComponent)
154};
155
156//==============================================================================
158{
159public:
161 : ParameterComponent (proc, param)
162 {
163 for (auto& button : buttons)
164 {
165 button.setRadioGroupId (293847);
166 button.setClickingTogglesState (true);
167 }
168
169 buttons[0].setButtonText (getParameter().getText (0.0f, 16));
170 buttons[1].setButtonText (getParameter().getText (1.0f, 16));
171
172 buttons[0].setConnectedEdges (Button::ConnectedOnRight);
173 buttons[1].setConnectedEdges (Button::ConnectedOnLeft);
174
175 // Set the initial value.
176 buttons[0].setToggleState (true, dontSendNotification);
177 handleNewParameterValue();
178
179 buttons[1].onStateChange = [this] { rightButtonChanged(); };
180
181 for (auto& button : buttons)
182 addAndMakeVisible (button);
183 }
184
185 void paint (Graphics&) override {}
186
187 void resized() override
188 {
189 auto area = getLocalBounds().reduced (0, 8);
190 area.removeFromLeft (8);
191
192 for (auto& button : buttons)
193 button.setBounds (area.removeFromLeft (80));
194 }
195
196 void handleNewParameterValue() override
197 {
198 bool newState = isParameterOn();
199
200 if (buttons[1].getToggleState() != newState)
201 {
204 }
205 }
206
207private:
208 void rightButtonChanged()
209 {
210 auto buttonState = buttons[1].getToggleState();
211
212 if (isParameterOn() != buttonState)
213 {
214 getParameter().beginChangeGesture();
215
216 if (getParameter().getAllValueStrings().isEmpty())
217 {
218 getParameter().setValueNotifyingHost (buttonState ? 1.0f : 0.0f);
219 }
220 else
221 {
222 // When a parameter provides a list of strings we must set its
223 // value using those strings, rather than a float, because VSTs can
224 // have uneven spacing between the different allowed values and we
225 // want the snapping behaviour to be consistent with what we do with
226 // a combo box.
227 auto selectedText = buttons[buttonState ? 1 : 0].getButtonText();
228 getParameter().setValueNotifyingHost (getParameter().getValueForText (selectedText));
229 }
230
231 getParameter().endChangeGesture();
232 }
233 }
234
235 bool isParameterOn() const
236 {
237 if (getParameter().getAllValueStrings().isEmpty())
238 return getParameter().getValue() > 0.5f;
239
240 auto index = getParameter().getAllValueStrings()
241 .indexOf (getParameter().getCurrentValueAsText());
242
243 if (index < 0)
244 {
245 // The parameter is producing some unexpected text, so we'll do
246 // some linear interpolation.
247 index = roundToInt (getParameter().getValue());
248 }
249
250 return index == 1;
251 }
252
253 TextButton buttons[2];
254
255 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SwitchParameterComponent)
256};
257
258//==============================================================================
260{
261public:
263 : ParameterComponent (proc, param),
264 parameterValues (getParameter().getAllValueStrings())
265 {
266 box.addItemList (parameterValues, 1);
267
268 // Set the initial value.
269 handleNewParameterValue();
270
271 box.onChange = [this] { boxChanged(); };
272 addAndMakeVisible (box);
273 }
274
275 void paint (Graphics&) override {}
276
277 void resized() override
278 {
279 auto area = getLocalBounds();
280 area.removeFromLeft (8);
281 box.setBounds (area.reduced (0, 10));
282 }
283
284private:
285 void handleNewParameterValue() override
286 {
287 auto index = parameterValues.indexOf (getParameter().getCurrentValueAsText());
288
289 if (index < 0)
290 {
291 // The parameter is producing some unexpected text, so we'll do
292 // some linear interpolation.
293 index = roundToInt (getParameter().getValue() * (float) (parameterValues.size() - 1));
294 }
295
297 }
298
299 void boxChanged()
300 {
301 if (getParameter().getCurrentValueAsText() != box.getText())
302 {
303 getParameter().beginChangeGesture();
304
305 // When a parameter provides a list of strings we must set its
306 // value using those strings, rather than a float, because VSTs can
307 // have uneven spacing between the different allowed values.
308 getParameter().setValueNotifyingHost (getParameter().getValueForText (box.getText()));
309
310 getParameter().endChangeGesture();
311 }
312 }
313
314 ComboBox box;
315 const StringArray parameterValues;
316
317 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChoiceParameterComponent)
318};
319
320//==============================================================================
322{
323public:
325 : ParameterComponent (proc, param)
326 {
327 if (getParameter().getNumSteps() != AudioProcessor::getDefaultNumParameterSteps())
328 slider.setRange (0.0, 1.0, 1.0 / (getParameter().getNumSteps() - 1.0));
329 else
330 slider.setRange (0.0, 1.0);
331
332 slider.setDoubleClickReturnValue (true, param.getDefaultValue());
333
334 slider.setScrollWheelEnabled (false);
335 addAndMakeVisible (slider);
336
338 valueLabel.setBorderSize ({ 1, 1, 1, 1 });
340 addAndMakeVisible (valueLabel);
341
342 // Set the initial value.
343 handleNewParameterValue();
344
345 slider.onValueChange = [this] { sliderValueChanged(); };
346 slider.onDragStart = [this] { sliderStartedDragging(); };
347 slider.onDragEnd = [this] { sliderStoppedDragging(); };
348 }
349
350 void paint (Graphics&) override {}
351
352 void resized() override
353 {
354 auto area = getLocalBounds().reduced (0, 10);
355
356 valueLabel.setBounds (area.removeFromRight (80));
357
358 area.removeFromLeft (6);
359 slider.setBounds (area);
360 }
361
362 void handleNewParameterValue() override
363 {
364 if (! isDragging)
365 {
366 slider.setValue (getParameter().getValue(), dontSendNotification);
367 updateTextDisplay();
368 }
369 }
370
371private:
372 void updateTextDisplay()
373 {
374 valueLabel.setText (getParameter().getCurrentValueAsText(), dontSendNotification);
375 }
376
377 void sliderValueChanged()
378 {
379 auto newVal = (float) slider.getValue();
380
381 if (! approximatelyEqual (getParameter().getValue(), newVal))
382 {
383 if (! isDragging)
384 getParameter().beginChangeGesture();
385
386 getParameter().setValueNotifyingHost ((float) slider.getValue());
387 updateTextDisplay();
388
389 if (! isDragging)
390 getParameter().endChangeGesture();
391 }
392 }
393
394 void sliderStartedDragging()
395 {
396 isDragging = true;
397 getParameter().beginChangeGesture();
398 }
399
400 void sliderStoppedDragging()
401 {
402 isDragging = false;
403 getParameter().endChangeGesture();
404 }
405
407 Label valueLabel;
408 bool isDragging = false;
409
410 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SliderParameterComponent)
411};
412
413//==============================================================================
416 private AsyncUpdater
417{
418public:
420 : editor (editorIn), parameter (param)
421 {
422 editor.processor.addListener (this);
423
424 parameterName.setText (parameter.getName (128), dontSendNotification);
426 parameterName.setInterceptsMouseClicks (false, false);
427 addAndMakeVisible (parameterName);
428
429 parameterLabel.setText (parameter.getLabel(), dontSendNotification);
430 parameterLabel.setInterceptsMouseClicks (false, false);
431 addAndMakeVisible (parameterLabel);
432
433 addAndMakeVisible (*(parameterComp = createParameterComp (editor.processor)));
434
435 setSize (400, 40);
436 }
437
439 {
441 editor.processor.removeListener (this);
442 }
443
444 void resized() override
445 {
446 auto area = getLocalBounds();
447
448 parameterName.setBounds (area.removeFromLeft (100));
449 parameterLabel.setBounds (area.removeFromRight (50));
450 parameterComp->setBounds (area);
451 }
452
453 void mouseDown (const MouseEvent& e) override
454 {
455 if (e.mods.isRightButtonDown())
456 if (auto* context = editor.getHostContext())
457 if (auto menu = context->getContextMenuForParameter (&parameter))
458 menu->getEquivalentPopupMenu().showMenuAsync (PopupMenu::Options().withTargetComponent (this)
459 .withMousePosition());
460 }
461
462private:
463 AudioProcessorEditor& editor;
464 AudioProcessorParameter& parameter;
465 Label parameterName, parameterLabel;
467
468 std::unique_ptr<ParameterComponent> createParameterComp (AudioProcessor& processor) const
469 {
470 // The AU, AUv3 and VST (only via a .vstxml file) SDKs support
471 // marking a parameter as boolean. If you want consistency across
472 // all formats then it might be best to use a
473 // SwitchParameterComponent instead.
474 if (parameter.isBoolean())
475 return std::make_unique<BooleanParameterComponent> (processor, parameter);
476
477 // Most hosts display any parameter with just two steps as a switch.
478 if (parameter.getNumSteps() == 2)
479 return std::make_unique<SwitchParameterComponent> (processor, parameter);
480
481 // If we have a list of strings to represent the different states a
482 // parameter can be in then we should present a dropdown allowing a
483 // user to pick one of them.
484 if (! parameter.getAllValueStrings().isEmpty()
485 && std::abs (parameter.getNumSteps() - parameter.getAllValueStrings().size()) <= 1)
486 return std::make_unique<ChoiceParameterComponent> (processor, parameter);
487
488 // Everything else can be represented as a slider.
489 return std::make_unique<SliderParameterComponent> (processor, parameter);
490 }
491
492 void audioProcessorParameterChanged (AudioProcessor*, int, float) override {}
493
494 void audioProcessorChanged (AudioProcessor*, const ChangeDetails& details) override
495 {
496 if (! details.parameterInfoChanged)
497 return;
498
499 if (MessageManager::getInstance()->isThisTheMessageThread())
500 handleAsyncUpdate();
501 else
503 }
504
505 void handleAsyncUpdate() override
506 {
507 parameterName .setText (parameter.getName (128), dontSendNotification);
508 parameterLabel.setText (parameter.getLabel(), dontSendNotification);
509
510 if (auto* p = parameterComp.get())
511 p->handleNewParameterValue();
512 }
513
514 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ParameterDisplayComponent)
515};
516
517//==============================================================================
519{
521 : editor (editorIn), param (paramIn) {}
522
523 bool mightContainSubItems() override { return false; }
524
526 {
527 return std::make_unique<ParameterDisplayComponent> (editor, param);
528 }
529
530 int getItemHeight() const override { return 40; }
531
532 AudioProcessorEditor& editor;
534};
535
537{
539 : name (group.getName())
540 {
541 for (auto* node : group)
542 {
543 if (auto* param = node->getParameter())
544 if (param->isAutomatable())
545 addSubItem (new ParamControlItem (editor, *param));
546
547 if (auto* inner = node->getGroup())
548 {
549 auto groupItem = std::make_unique<ParameterGroupItem> (editor, *inner);
550
551 if (groupItem->getNumSubItems() != 0)
552 addSubItem (groupItem.release());
553 }
554 }
555 }
556
557 bool mightContainSubItems() override { return getNumSubItems() > 0; }
558
560 {
561 return std::make_unique<Label> (name, name);
562 }
563
564 String name;
565};
566
567//==============================================================================
569{
571 : legacyParameters (editor.processor, false),
572 groupItem (editor, legacyParameters.getGroup())
573 {
574 const auto numIndents = getNumIndents (groupItem);
575 const auto width = 400 + view.getIndentSize() * numIndents;
576
577 view.setSize (width, 400);
578 view.setDefaultOpenness (true);
579 view.setRootItemVisible (false);
580 view.setRootItem (&groupItem);
581 }
582
583 static int getNumIndents (const TreeViewItem& item)
584 {
585 int maxInner = 0;
586
587 for (auto i = 0; i < item.getNumSubItems(); ++i)
588 maxInner = jmax (maxInner, 1 + getNumIndents (*item.getSubItem (i)));
589
590 return maxInner;
591 }
592
593 LegacyAudioParametersWrapper legacyParameters;
594 ParameterGroupItem groupItem;
595 TreeView view;
596};
597
598//==============================================================================
599GenericAudioProcessorEditor::GenericAudioProcessorEditor (AudioProcessor& p)
600 : AudioProcessorEditor (p), pimpl (std::make_unique<Pimpl> (*this))
601{
602 auto* viewport = pimpl->view.getViewport();
603
604 setOpaque (true);
605 addAndMakeVisible (pimpl->view);
606
607 setResizable (true, false);
608 setSize (viewport->getViewedComponent()->getWidth() + viewport->getVerticalScrollBar().getWidth(),
609 jlimit (125, 400, viewport->getViewedComponent()->getHeight()));
610}
611
612GenericAudioProcessorEditor::~GenericAudioProcessorEditor() = default;
613
618
620{
621 pimpl->view.setBounds (getLocalBounds());
622}
623
624} // namespace juce
Has a callback method that is triggered asynchronously.
void triggerAsyncUpdate()
Causes the callback to be triggered at a later time.
void cancelPendingUpdate() noexcept
This will stop any pending updates from happening.
Base class for the component that acts as the GUI for an AudioProcessor.
void setResizable(bool allowHostToResize, bool useBottomRightCornerResizer)
Sets whether the editor is resizable by the host and/or user.
AudioProcessor & processor
The AudioProcessor that this editor represents.
AudioProcessorEditorHostContext * getHostContext() const noexcept
Gets a context object, if one is available.
Base class for listeners that want to know about changes to an AudioProcessor.
A class encapsulating a group of AudioProcessorParameters and nested AudioProcessorParameterGroups.
A base class for listeners that want to know about changes to an AudioProcessorParameter.
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 String getText(float normalisedValue, int) const
Returns a textual version of the supplied normalised parameter value.
virtual int getNumSteps() const
Returns the number of steps that this parameter's range should be quantised into.
virtual bool isAutomatable() const
Returns true if the host can automate this parameter.
void beginChangeGesture()
Sends a signal to the host to tell it that the user is about to start changing this parameter.
void removeListener(Listener *listener)
Removes a previously registered parameter listener.
virtual StringArray getAllValueStrings() const
Returns the set of strings which represent the possible states a parameter can be in.
void setValueNotifyingHost(float newValue)
A processor should call this when it needs to change one of its parameters.
void endChangeGesture()
Tells the host that the user has finished changing this parameter.
void addListener(Listener *newListener)
Registers a listener to receive events when the parameter's state changes.
int getParameterIndex() const noexcept
Returns the index of this parameter in its parent processor's parameter list.
virtual bool isBoolean() const
Returns whether the parameter represents a boolean switch, typically with "On" and "Off" states.
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.
virtual void removeListener(AudioProcessorListener *listenerToRemove)
Removes a previously added listener.
virtual void addListener(AudioProcessorListener *newListener)
Adds a listener that will be called when an aspect of this processor changes.
static int getDefaultNumParameterSteps() noexcept
Returns the default number of steps for a parameter.
void resized() override
Called when this component's size has been changed.
void paint(Graphics &) override
Components can override this method to draw their content.
void setConnectedEdges(int connectedEdgeFlags)
Hints about which edges of the button might be connected to adjoining buttons.
bool getToggleState() const noexcept
Returns true if the button is 'on'.
void setToggleState(bool shouldBeOn, NotificationType notification)
A button has an on/off state associated with it, and this changes that.
void setButtonText(const String &newText)
Changes the button's text.
std::function< void()> onClick
You can assign a lambda to this callback object to have it called when the button is clicked.
const String & getButtonText() const
Returns the text displayed in the button.
Definition juce_Button.h:67
std::function< void()> onStateChange
You can assign a lambda to this callback object to have it called when the button's state changes.
void resized() override
Called when this component's size has been changed.
void paint(Graphics &) override
Components can override this method to draw their content.
void addItemList(const StringArray &items, int firstItemIdOffset)
Adds an array of items to the drop-down list.
void setSelectedItemIndex(int newItemIndex, NotificationType notification=sendNotificationAsync)
Sets one of the items to be the current selection.
std::function< void()> onChange
You can assign a lambda to this callback object to have it called when the selected ID is changed.
String getText() const
Returns the text that is currently shown in the combo-box's text field.
The base class for all JUCE user-interface objects.
void setInterceptsMouseClicks(bool allowClicksOnThisComponent, bool allowClicksOnChildComponents) noexcept
Changes the default return value for the hitTest() method.
void addAndMakeVisible(Component *child, int zOrder=-1)
Adds a child component to this one, and also makes the child visible if it isn't already.
void setOpaque(bool shouldBeOpaque)
Indicates whether any parts of the component might be transparent.
void setBounds(int x, int y, int width, int height)
Changes the component's position and size.
void setSize(int newWidth, int newHeight)
Changes the size of the component.
void setColour(int colourID, Colour newColour)
Registers a colour to be used for a particular purpose.
Colour findColour(int colourID, bool inheritFromParent=false) const
Looks for a colour that has been registered with the given colour ID number.
LookAndFeel & getLookAndFeel() const noexcept
Finds the appropriate look-and-feel to use for this component.
Rectangle< int > getLocalBounds() const noexcept
Returns the component's bounds, relative to its own origin.
void paint(Graphics &) override
Components can override this method to draw their content.
void resized() override
Called when this component's size has been changed.
A graphics context, used for drawing a component or image.
void fillAll() const
Fills the context's entire clip region with the current colour or brush.
@ centredRight
Indicates that the item should be centred vertically but placed on the right hand side.
@ centred
Indicates that the item should be centred vertically and horizontally.
A component that displays a text string, and can optionally become a text editor when clicked.
Definition juce_Label.h:41
@ outlineColourId
An optional colour to use to draw a border around the label.
Definition juce_Label.h:108
void setJustificationType(Justification justification)
Sets the style of justification to be used for positioning the text.
void setBorderSize(BorderSize< int > newBorderSize)
Changes the border that is left between the edge of the component and the text.
void setText(const String &newText, NotificationType notification)
Changes the label text.
static MessageManager * getInstance()
Returns the global instance of the MessageManager.
bool isRightButtonDown() const noexcept
Checks whether the flag is set for the right mouse-button.
Contains position and status information about a mouse event.
const ModifierKeys mods
The key modifiers associated with the event.
void resized() override
Called when this component's size has been changed.
void mouseDown(const MouseEvent &e) override
Called when a mouse button is pressed.
Class used to create a set of options to pass to the show() method.
Rectangle reduced(ValueType deltaX, ValueType deltaY) const noexcept
Returns a rectangle that is smaller than this one by a given amount.
Rectangle removeFromLeft(ValueType amountToRemove) noexcept
Removes a strip from the left-hand edge of this rectangle, reducing this rectangle by the specified a...
@ backgroundColourId
A colour to use to fill the window's background.
void paint(Graphics &) override
Components can override this method to draw their content.
void resized() override
Called when this component's size has been changed.
std::function< void()> onDragStart
You can assign a lambda to this callback object to have it called when the slider's drag begins.
void setDoubleClickReturnValue(bool shouldDoubleClickBeEnabled, double valueToSetOnDoubleClick, ModifierKeys singleClickModifiers=ModifierKeys::altModifier)
This lets you choose whether double-clicking or single-clicking with a specified key modifier moves t...
std::function< void()> onValueChange
You can assign a lambda to this callback object to have it called when the slider value is changed.
void setScrollWheelEnabled(bool enabled)
This can be used to stop the mouse scroll-wheel from moving the slider.
std::function< void()> onDragEnd
You can assign a lambda to this callback object to have it called when the slider's drag ends.
double getValue() const
Returns the slider's current value.
@ LinearHorizontal
A traditional horizontal slider.
Definition juce_Slider.h:63
@ textBoxOutlineColourId
The colour to use for a border around the text-editor box.
void setValue(double newValue, NotificationType notification=sendNotificationAsync)
Changes the slider's current value.
@ NoTextBox
Doesn't display a text box.
Definition juce_Slider.h:95
void setRange(double newMinimum, double newMaximum, double newInterval=0)
Sets the limits that the slider's value can take.
int indexOf(StringRef stringToLookFor, bool ignoreCase=false, int startIndex=0) const
Searches for a string in the array.
int size() const noexcept
Returns the number of strings in the array.
bool isEmpty() const noexcept
Returns true if the array is empty, false otherwise.
The JUCE String class!
Definition juce_String.h:53
void paint(Graphics &) override
Components can override this method to draw their content.
void resized() override
Called when this component's size has been changed.
Makes repeated callbacks to a virtual method at a specified time interval.
Definition juce_Timer.h:52
int getTimerInterval() const noexcept
Returns the timer's interval.
Definition juce_Timer.h:116
void startTimerHz(int timerFrequencyHz) noexcept
Starts the timer with an interval specified in Hertz.
void startTimer(int intervalInMilliseconds) noexcept
Starts the timer and sets the length of interval required.
An item in a TreeView.
int getNumSubItems() const noexcept
Returns the number of sub-items that have been added to this item.
void addSubItem(TreeViewItem *newItem, int insertPosition=-1)
Adds a sub-item.
TreeViewItem * getSubItem(int index) const noexcept
Returns one of the item's sub-items.
A tree-view component.
void setDefaultOpenness(bool isOpenByDefault)
Sets whether items are open or closed by default.
int getIndentSize() noexcept
Returns the number of pixels by which each nested level of the tree is indented.
void setRootItem(TreeViewItem *newRootItem)
Sets the item that is displayed in the TreeView.
void setRootItemVisible(bool shouldBeVisible)
Changes whether the tree's root item is shown or not.
T get(T... args)
#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.
constexpr bool approximatelyEqual(Type a, Type b, Tolerance< Type > tolerance=Tolerance< Type >{} .withAbsolute(std::numeric_limits< Type >::min()) .withRelative(std::numeric_limits< Type >::epsilon()))
Returns true if the two floating-point numbers are approximately equal.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Constrains a value to keep it within a given range.
@ dontSendNotification
No notification message should be sent.
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
int roundToInt(const FloatType value) noexcept
Fast floating-point-to-integer conversion.
A simple wrapper around std::atomic.
Definition juce_Atomic.h:42
bool compareAndSetBool(Type newValue, Type valueToCompare) noexcept
Atomically compares this value with a target value, and if it is equal, sets this to be equal to a ne...
Definition juce_Atomic.h:96
Provides details about aspects of an AudioProcessor which have changed.
bool mightContainSubItems() override
Tells the tree whether this item can potentially be opened.
std::unique_ptr< Component > createItemComponent() override
Creates a component that will be used to represent this item.
int getItemHeight() const override
Must return the height required by this item.
std::unique_ptr< Component > createItemComponent() override
Creates a component that will be used to represent this item.
bool mightContainSubItems() override
Tells the tree whether this item can potentially be opened.