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
Public Member Functions | List of all members
juce::ParameterAttachment Class Reference

Used to implement 'attachments' or 'controllers' that link a plug-in parameter to a UI element. More...

#include "juce_ParameterAttachments.h"

Inheritance diagram for juce::ParameterAttachment:
juce::AudioProcessorParameter::Listener juce::AsyncUpdater

Public Member Functions

 ParameterAttachment (RangedAudioParameter &parameter, std::function< void(float)> parameterChangedCallback, UndoManager *undoManager=nullptr)
 Listens to a parameter and calls the the provided function in response to parameter changes.
 
 ~ParameterAttachment () override
 Destructor.
 
void sendInitialUpdate ()
 Calls the parameterChangedCallback function that was registered in the constructor, making the UI reflect the current parameter state.
 
void setValueAsCompleteGesture (float newDenormalisedValue)
 Triggers a full gesture message on the managed parameter.
 
void beginGesture ()
 Begins a gesture on the managed parameter.
 
void setValueAsPartOfGesture (float newDenormalisedValue)
 Updates the parameter value during a gesture.
 
void endGesture ()
 Ends a gesture on the managed parameter.
 

Detailed Description

Used to implement 'attachments' or 'controllers' that link a plug-in parameter to a UI element.

To implement a new attachment type, create a new class which includes an instance of this class as a data member. Your class should pass a function to the constructor of the ParameterAttachment, which will then be called on the message thread when the parameter changes. You can use this function to update the state of the UI control. Your class should also register as a listener of the UI control and respond to respond to changes in the UI element by calling either setValueAsCompleteGesture or beginGesture, setValueAsPartOfGesture and endGesture.

Make sure to call sendInitialUpdate at the end of your new attachment's constructor, so that the UI immediately reflects the state of the parameter.

@tags{Audio}

Definition at line 46 of file juce_ParameterAttachments.h.

Constructor & Destructor Documentation

◆ ParameterAttachment()

juce::ParameterAttachment::ParameterAttachment ( RangedAudioParameter parameter,
std::function< void(float)>  parameterChangedCallback,
UndoManager undoManager = nullptr 
)

Listens to a parameter and calls the the provided function in response to parameter changes.

If an undoManager is supplied beginNewTransaction will be called on it whenever the UI requests a parameter change via this attachment.

Parameters
parameterThe parameter to which this attachment will listen
parameterChangedCallbackThe function that will be called on the message thread in response to parameter changes
undoManagerThe UndoManager that will be used to begin transactions when the UI requests a parameter change.

Definition at line 29 of file juce_ParameterAttachments.cpp.

◆ ~ParameterAttachment()

juce::ParameterAttachment::~ParameterAttachment ( )
override

Destructor.

Definition at line 39 of file juce_ParameterAttachments.cpp.

Member Function Documentation

◆ beginGesture()

void juce::ParameterAttachment::beginGesture ( )

Begins a gesture on the managed parameter.

Call this when the UI is about to begin a continuous interaction, like when the mouse button is pressed on a slider.

Definition at line 60 of file juce_ParameterAttachments.cpp.

◆ endGesture()

void juce::ParameterAttachment::endGesture ( )

Ends a gesture on the managed parameter.

Call this when the UI has finished a continuous interaction, like when the mouse button is released on a slider.

Definition at line 76 of file juce_ParameterAttachments.cpp.

◆ sendInitialUpdate()

void juce::ParameterAttachment::sendInitialUpdate ( )

Calls the parameterChangedCallback function that was registered in the constructor, making the UI reflect the current parameter state.

This function should be called after doing any necessary setup on the UI control that is being managed (e.g. adding ComboBox entries, making buttons toggle-able).

Definition at line 45 of file juce_ParameterAttachments.cpp.

◆ setValueAsCompleteGesture()

void juce::ParameterAttachment::setValueAsCompleteGesture ( float  newDenormalisedValue)

Triggers a full gesture message on the managed parameter.

Call this in the listener callback of the UI control in response to a one-off change in the UI like a button-press.

Definition at line 50 of file juce_ParameterAttachments.cpp.

◆ setValueAsPartOfGesture()

void juce::ParameterAttachment::setValueAsPartOfGesture ( float  newDenormalisedValue)

Updates the parameter value during a gesture.

Call this during a continuous interaction, like a slider value changed callback.

Definition at line 68 of file juce_ParameterAttachments.cpp.


The documentation for this class was generated from the following files: