Jamba C++ API 7.5.0
Loading...
Searching...
No Matches
ParamAwareView< TView > Class Template Reference

This subclass allows for registering callbacks to any kind of view without having to inherit from it. More...

#include <ParamAware.h>

Inherits ParamAware.

Inherited by ViewGUIParamCxAware< TView >.

Public Types

using ChangeListener = std::function<void(TView *, ParamID)>

Public Member Functions

void onParameterChange (ParamID iParamID) override
 This implementation simply delegates to the listener registered by registerListener().
 ParamAwareView (TView *iView)
template<typename T>
GUIJmbParam< T > registerCallback (GUIJmbParam< T > &iParam, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Convenient call to register a callback for the Jmb param simply by using the param from the state (accessible in state-aware views via fState->fMyParam).
template<typename T>
GUIJmbParam< T > registerCallback (GUIJmbParam< T > &iParam, Parameters::ChangeCallback1< GUIJmbParam< T > > iChangeCallback, bool iInvokeCallback=false)
 Convenient call to register a callback for the Jmb param simply by using the param from the state (accessible in state-aware views via fState->fMyParam).
template<typename T>
GUIJmbParam< T > registerCallback (GUIJmbParam< T > &iParam, Parameters::ChangeCallback2< TView, GUIJmbParam< T > > iChangeCallback, bool iInvokeCallback=false)
 Register a callback for the Jmb parameter.
template<typename T>
GUIJmbParam< T > registerCallback (JmbParam< T > const &iParamDef, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Convenient call to register a callback for the Jmb param simply by using its description (accessible in state-aware views via fParams->fMyParam).
template<typename T>
GUIJmbParam< T > registerCallback (JmbParam< T > const &iParamDef, Parameters::ChangeCallback1< GUIJmbParam< T > > iChangeCallback, bool iInvokeCallback=false)
 Convenient call to register a callback for the Jmb param simply by using its description (accessible in state-aware views via fParams->fMyParam).
GUIRawVstParam registerCallback (RawVstParam const &iParamDef, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Registers a raw parameter (no conversion).
GUIRawVstParam registerCallback (RawVstParam const &iParamDef, Parameters::ChangeCallback1< GUIRawVstParam > iChangeCallback, bool iInvokeCallback=false)
 Registers a raw parameter (no conversion).
template<typename T>
GUIVstParam< T > registerCallback (VstParam< T > const &iParamDef, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Convenient call to register a callback for the Vst param simply by using its description (accessible in state-aware views via fParams->fMyParam).
template<typename T>
GUIVstParam< T > registerCallback (VstParam< T > const &iParamDef, Parameters::ChangeCallback1< GUIVstParam< T > > iChangeCallback, bool iInvokeCallback=false)
 Convenient call to register a callback for the Vst param simply by using its description (accessible in state-aware views via fParams->fMyParam).
template<typename T>
GUIVstParam< T > registerCallback (VstParam< T > const &iParamDef, Parameters::ChangeCallback2< TView, GUIVstParam< T > > iChangeCallback, bool iInvokeCallback=false)
 Register a callback for the Vst parameter.
void registerListener (ChangeListener iListener)
 Registers a listener invoked when a parameter changes.
Public Member Functions inherited from ParamAware
virtual void initState (GUIState *iGUIState)
 Called during initialization.
void invokeAll ()
 Invoke all (currently) registered callbacks and onParameterChange() (if registered).
IGUIParam registerBaseCallback (ParamID iParamID, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback)
 Registers a callback for the "base" param for the most generic use case.
IGUIParam registerBaseCallback (ParamID iParamID, Parameters::ChangeCallback1< IGUIParam > iChangeCallback, bool iInvokeCallback)
 Registers a callback for the "base" param for the most generic use case.
IGUIParam registerBaseParam (ParamID iParamID, bool iSubscribeToChanges=true)
 Registers the "base" param for the most generic use case but as a result is fairly limited and mainly gives access to the string representation of the param.
template<typename T>
GUIJmbParam< T > registerCallback (GUIJmbParam< T > &iParam, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Convenient call to register a callback for the Jmb param simply by using the param from the state (accessible in state-aware views via fState->fMyParam).
template<typename T>
GUIJmbParam< T > registerCallback (GUIJmbParam< T > &iParam, Parameters::ChangeCallback1< GUIJmbParam< T > > iChangeCallback, bool iInvokeCallback=false)
 Convenient call to register a callback for the Jmb param simply by using the param from the state (accessible in state-aware views via fState->fMyParam).
template<typename T>
GUIJmbParam< T > registerCallback (JmbParam< T > const &iParamDef, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Convenient call to register a callback for the Jmb param simply by using its description (accessible in state-aware views via fParams->fMyParam).
template<typename T>
GUIJmbParam< T > registerCallback (JmbParam< T > const &iParamDef, Parameters::ChangeCallback1< GUIJmbParam< T > > iChangeCallback, bool iInvokeCallback=false)
 Convenient call to register a callback for the Jmb param simply by using its description (accessible in state-aware views via fParams->fMyParam).
GUIRawVstParam registerCallback (RawVstParam const &iParamDef, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Registers a raw parameter (no conversion).
GUIRawVstParam registerCallback (RawVstParam const &iParamDef, Parameters::ChangeCallback1< GUIRawVstParam > iChangeCallback, bool iInvokeCallback=false)
 Registers a raw parameter (no conversion).
template<typename T>
GUIVstParam< T > registerCallback (VstParam< T > const &iParamDef, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Convenient call to register a callback for the Vst param simply by using its description (accessible in state-aware views via fParams->fMyParam).
template<typename T>
GUIVstParam< T > registerCallback (VstParam< T > const &iParamDef, Parameters::ChangeCallback1< GUIVstParam< T > > iChangeCallback, bool iInvokeCallback=false)
 Convenient call to register a callback for the Vst param simply by using its description (accessible in state-aware views via fParams->fMyParam).
template<typename T>
GUIJmbParam< T > registerJmbCallback (ParamID iParamID, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Registers a callback for the Jmb param by its id and return the wrapper to the param.
template<typename T>
GUIJmbParam< T > registerJmbCallback (ParamID iParamID, Parameters::ChangeCallback1< GUIJmbParam< T > > iChangeCallback, bool iInvokeCallback=false)
 Registers a callback for the Jmb param by its id and return the wrapper to the param.
template<typename T>
GUIJmbParam< T > registerJmbParam (ParamID iParamID, bool iSubscribeToChanges=true)
 Registers the Jmb param by its id and return the wrapper to the param.
template<typename T>
GUIOptionalParam< T > registerOptionalCallback (ParamID iParamID, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Registers an optional parameter which handles Vst, Jmb or no parameter at all.
template<typename T>
GUIOptionalParam< T > registerOptionalCallback (ParamID iParamID, Parameters::ChangeCallback1< GUIOptionalParam< T > > iChangeCallback, bool iInvokeCallback=false)
 Registers an optional parameter which handles Vst, Jmb or no parameter at all.
GUIOptionalParam< int32 > registerOptionalDiscreteCallback (ParamID iParamID, int32 iStepCount, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Registers an optional discrete parameter which handles Vst, Jmb or no parameter at all.
GUIOptionalParam< int32 > registerOptionalDiscreteCallback (ParamID iParamID, int32 iStepCount, Parameters::ChangeCallback1< GUIOptionalParam< int32 > > iChangeCallback, bool iInvokeCallback=false)
 Registers an optional discrete parameter which handles Vst, Jmb or no parameter at all.
GUIOptionalParam< int32 > registerOptionalDiscreteParam (ParamID iParamID, int32 iStepCount, bool iSubscribeToChanges=true)
 Registers an optional discrete parameter which handles Vst, Jmb or no parameter at all.
template<typename T>
GUIOptionalParam< T > registerOptionalParam (ParamID iParamID, bool iSubscribeToChanges=true)
 Registers an optional parameter which handles Vst, Jmb or no parameter at all.
template<typename T>
GUIJmbParam< T > registerParam (GUIJmbParam< T > &iParam, bool iSubscribeToChanges=true)
 Convenient call to register a Jmb param simply by using the param from the state (accessible in state-aware views via fState->fMyParam).
template<typename T>
GUIJmbParam< T > registerParam (JmbParam< T > const &iParamDef, bool iSubscribeToChanges=true)
 Convenient call to register a Jmb param simply by using its description (accessible in state-aware views via fParams->fMyParam).
GUIRawVstParam registerParam (RawVstParam const &iParamDef, bool iSubscribeToChanges=true)
 Registers a raw parameter (no conversion).
template<typename T>
GUIVstParam< T > registerParam (VstParam< T > const &iParamDef, bool iSubscribeToChanges=true)
 Convenient call to register a Vst param simply by using its description (accessible in state-aware views via fParams->fMyParam).
virtual void registerParameters ()
 Subclasses should override this method to register each parameter.
GUIRawVstParam registerRawVstCallback (ParamID iParamID, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Registers a raw parameter (no conversion) The callback will be invoked when the parameter changes.
GUIRawVstParam registerRawVstCallback (ParamID iParamID, Parameters::ChangeCallback1< GUIRawVstParam > iChangeCallback, bool iInvokeCallback=false)
 Registers a raw parameter (no conversion) The callback will be invoked when the parameter changes.
GUIRawVstParam registerRawVstParam (ParamID iParamID, bool iSubscribeToChanges=true)
 Registers a raw parameter (no conversion) onParameterChange() will be called on changes (if iSubscribeToChanges is set to true).
GUIVstParam< bool > registerVstBooleanParam (ParamID iParamID, bool iSubscribeToChanges=true)
template<typename T>
GUIVstParam< T > registerVstCallback (ParamID iParamID, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 Register a callback for a Vst parameter simply given its id The callback will be invoked when the parameter changes.
template<typename T>
GUIVstParam< T > registerVstCallback (ParamID iParamID, Parameters::ChangeCallback1< GUIVstParam< T > > iChangeCallback, bool iInvokeCallback=false)
 Register a callback for a Vst parameter simply given its id The callback will be invoked when the parameter changes.
template<typename T>
GUIVstParam< T > registerVstParam (ParamID iParamID, bool iSubscribeToChanges=true)
 Register a Vst parameter simply given its id onParameterChange() will be called on changes (if iSubscribeToChanges is set to true).
GUIVstParam< PercentregisterVstPercentParam (ParamID iParamID, bool iSubscribeToChanges=true)
void unregisterAll ()
 Unregisters all parameters.
template<typename T>
GUIJmbParam< T > unregisterParam (GUIJmbParam< T > const &iParam)
 Removes the registration of the provided param (closing the connection/stopping to listen).
GUIRawVstParam unregisterParam (GUIRawVstParam const &iParam)
 Removes the registration of the provided param (closing the connection/stopping to listen).
template<typename T>
GUIVstParam< T > unregisterParam (GUIVstParam< T > const &iParam)
 Removes the registration of the provided param (closing the connection/stopping to listen).
bool unregisterParam (ParamID iParamID)
 Removes the registration of the provided param (closing the connection/stopping to listen).
virtual ~ParamAware ()

Protected Attributes

ChangeListener fListener
TView * fView
Protected Attributes inherited from ParamAware
std::unique_ptr< GUIParamCxMgrfParamCxMgr {}

Detailed Description

template<typename TView>
class pongasoft::VST::GUI::Params::ParamAwareView< TView >

This subclass allows for registering callbacks to any kind of view without having to inherit from it.

Template Parameters
TViewshould be a subclass of VSTGUI::CView
See also
StateAwareCustomController::makeParamAware()

Member Typedef Documentation

◆ ChangeListener

template<typename TView>
using ChangeListener = std::function<void(TView *, ParamID)>

Constructor & Destructor Documentation

◆ ParamAwareView()

template<typename TView>
ParamAwareView ( TView * iView)
inlineexplicit

Member Function Documentation

◆ onParameterChange()

template<typename TView>
void onParameterChange ( ParamID iParamID)
inlineoverridevirtual

This implementation simply delegates to the listener registered by registerListener().

Reimplemented from ParamAware.

◆ registerCallback() [1/10]

template<typename TView>
template<typename T>
GUIJmbParam< T > registerCallback ( GUIJmbParam< T > & iParam,
Parameters::ChangeCallback iChangeCallback,
bool iInvokeCallback = false )
inline

Convenient call to register a callback for the Jmb param simply by using the param from the state (accessible in state-aware views via fState->fMyParam).

Takes care of the type due to method API.

Returns
empty param if not found or not proper type

◆ registerCallback() [2/10]

template<typename TView>
template<typename T>
GUIJmbParam< T > registerCallback ( GUIJmbParam< T > & iParam,
Parameters::ChangeCallback1< GUIJmbParam< T > > iChangeCallback,
bool iInvokeCallback = false )
inline

Convenient call to register a callback for the Jmb param simply by using the param from the state (accessible in state-aware views via fState->fMyParam).

Takes care of the type due to method API.

Example:

registerCallback<int>(fParams->fMyParam,
[] (GUIJmbParam<int> &iParam) { iParam.getValue()...; });
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition GUIJmbParameter.h:497
GUIVstParam< T > registerCallback(VstParam< T > const &iParamDef, Parameters::ChangeCallback2< TView, GUIVstParam< T > > iChangeCallback, bool iInvokeCallback=false)
Register a callback for the Vst parameter.
Definition ParamAware.h:604
Returns
empty param if not found or not proper type

◆ registerCallback() [3/10]

template<typename TView>
template<typename T>
GUIJmbParam< T > registerCallback ( GUIJmbParam< T > & iParam,
Parameters::ChangeCallback2< TView, GUIJmbParam< T > > iChangeCallback,
bool iInvokeCallback = false )
inline

Register a callback for the Jmb parameter.

This version is specific to this class and allows for the view to be passed back (since the view is not inheriting from this class).

// Example
registerCallback<Range>(fState->fMyParam,
[] (CTextLabel *iView, GUIJmbParam<Range> &iParam) {
iParam.getValue()...;
});
Returns
empty param if not found or not proper type

◆ registerCallback() [4/10]

template<typename TView>
template<typename T>
GUIJmbParam< T > registerCallback ( JmbParam< T > const & iParamDef,
Parameters::ChangeCallback iChangeCallback,
bool iInvokeCallback = false )
inline

Convenient call to register a callback for the Jmb param simply by using its description (accessible in state-aware views via fParams->fMyParam).

Takes care of the type due to method API.

Returns
empty param if not found or not proper type

◆ registerCallback() [5/10]

template<typename TView>
template<typename T>
GUIJmbParam< T > registerCallback ( JmbParam< T > const & iParamDef,
Parameters::ChangeCallback1< GUIJmbParam< T > > iChangeCallback,
bool iInvokeCallback = false )
inline

Convenient call to register a callback for the Jmb param simply by using its description (accessible in state-aware views via fParams->fMyParam).

Takes care of the type due to method API.

Example:

registerCallback<int>(fParams->fMyParam,
[] (GUIJmbParam<int> &iParam) { iParam.getValue()...; });
Returns
empty param if not found or not proper type

◆ registerCallback() [6/10]

template<typename TView>
GUIRawVstParam registerCallback ( RawVstParam const & iParamDef,
Parameters::ChangeCallback iChangeCallback,
bool iInvokeCallback = false )
inline

Registers a raw parameter (no conversion).

Convenient call using the param def (accessible in state-aware views via fParams->fMyParam).

◆ registerCallback() [7/10]

template<typename TView>
GUIRawVstParam registerCallback ( RawVstParam const & iParamDef,
Parameters::ChangeCallback1< GUIRawVstParam > iChangeCallback,
bool iInvokeCallback = false )
inline

Registers a raw parameter (no conversion).

Convenient call using the param def (accessible in state-aware views via fParams->fMyParam).

◆ registerCallback() [8/10]

template<typename TView>
template<typename T>
GUIVstParam< T > registerCallback ( VstParam< T > const & iParamDef,
Parameters::ChangeCallback iChangeCallback,
bool iInvokeCallback = false )
inline

Convenient call to register a callback for the Vst param simply by using its description (accessible in state-aware views via fParams->fMyParam).

Takes care of the type due to method API.

Returns
empty param if not found or not proper type

◆ registerCallback() [9/10]

template<typename TView>
template<typename T>
GUIVstParam< T > registerCallback ( VstParam< T > const & iParamDef,
Parameters::ChangeCallback1< GUIVstParam< T > > iChangeCallback,
bool iInvokeCallback = false )
inline

Convenient call to register a callback for the Vst param simply by using its description (accessible in state-aware views via fParams->fMyParam).

Takes care of the type due to method API.

Example:

registerCallback<int>(fParams->fMyParam,
[] (GUIVstParam<int> &iParam) { iParam.getValue()...; });
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition GUIVstParameter.h:280
Returns
empty param if not found or not proper type

◆ registerCallback() [10/10]

template<typename TView>
template<typename T>
GUIVstParam< T > registerCallback ( VstParam< T > const & iParamDef,
Parameters::ChangeCallback2< TView, GUIVstParam< T > > iChangeCallback,
bool iInvokeCallback = false )
inline

Register a callback for the Vst parameter.

This version is specific to this class and allows for the view to be passed back (since the view is not inheriting from this class).

// Example
registerCallback<bool>(fParams->fMyParam,
[] (CTextLabel *iView, GUIVstParam<bool> &iParam) {
iParam.getValue()...;
});
Returns
empty param if not found or not proper type

◆ registerListener()

template<typename TView>
void registerListener ( ChangeListener iListener)
inline

Registers a listener invoked when a parameter changes.

Since this class is intended to be used without inheriting from a view, you cannot implement the onParameterChange() method. As a result, you can use this method to set a listener that will be invoked instead.

Member Data Documentation

◆ fListener

template<typename TView>
ChangeListener fListener
protected

◆ fView

template<typename TView>
TView* fView
protected

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