Jamba C++ API  4.0.0
GUIState Class Reference

#include <GUIState.h>

Inherits IMessageProducer.

Inherited by GUIPluginState< TPluginParameters >.

Public Member Functions

template<typename T >
GUIJmbParam< T > add (JmbParam< T > iParamDef)
 This method is called for each parameter managed by the GUIState that is not a regular VST parameter. More...
 
template<typename T >
tresult broadcast (JmbParam< T > const &iParamDef, T const &iMessage)
 Broadcast a message without requiring the need to instantiate a GUIJmbParam. More...
 
std::unique_ptr< FObjectCxconnect (ParamID iParamID, Parameters::IChangeListener *iChangeListener) const
 Connects the paramID to the listener. More...
 
std::unique_ptr< FObjectCxconnect (ParamID iParamID, Parameters::ChangeCallback iChangeCallback) const
 Connects the paramID to the callback. More...
 
std::unique_ptr< GUIParamCxMgrcreateParamCxMgr ()
 The CustomView class automatically calls this method to get a handle of a ParamCxMgr used to register for interest and obtain GUIParam instances. More...
 
bool existsJmb (ParamID iParamID) const
 
bool existsVst (ParamID iParamID) const
 
std::shared_ptr< IGUIParameterfindParam (ParamID iParamID) const
 Generic call which returns a param with the given id or nullptr if there isn't one. More...
 
std::vector< ParamID > const & getAllRegistrationOrder () const
 
template<typename T >
std::shared_ptr< GUIVstParameter< T > > getGUIVstParameter (ParamID iParamID) const
 
template<typename T >
std::shared_ptr< GUIVstParameter< T > > getGUIVstParameter (VstParam< T > iParamDef) const
 
std::shared_ptr< IGUIJmbParametergetJmbParameter (ParamID iParamID) const
 
Parameters const & getPluginParameters () const
 
std::shared_ptr< RawVstParamDefgetRawVstParamDef (ParamID iParamID) const
 
std::shared_ptr< GUIRawVstParametergetRawVstParameter (ParamID iParamID) const
 
 GUIState (Parameters const &iPluginParameters)
 
tresult handleMessage (Message const &iMessage)
 Handle an incoming message => will forward to JmbParam marked shared by rtOwner. More...
 
virtual tresult init (VstParametersSPtr iVstParameters, IMessageProducer *iMessageProducer)
 Called by the GUIController. More...
 
template<typename TView >
ParamAwareView< TView > * makeParamAware (TView *iView)
 Allow for registering an arbitrary callback on an arbitrary view without having to inherit from the view. More...
 
virtual tresult readGUIState (IBStreamer &iStreamer)
 This method is called from the GUI controller setState method and reads the state previously saved by the GUI only (parameters that are ui only) and initializes the vst host parameters accordingly. More...
 
virtual tresult readRTState (IBStreamer &iStreamer)
 This method is called from the GUI controller setComponentState method and reads the state coming from RT and initializes the vst host parameters accordingly. More...
 
template<typename TView >
ParamAwareView< TView > * registerConnectionFor (TView *iView)
 
virtual tresult writeGUIState (IBStreamer &oStreamer) const
 This method is called from the GUI controller getState method and writes the state specific to the GUI only (parameters that are ui only), reading the values from the vst host parameters. More...
 
- Public Member Functions inherited from IMessageProducer
virtual ~IMessageProducer ()=default
 

Protected Member Functions

void addJmbParam (std::shared_ptr< IGUIJmbParameter > iParameter)
 
IPtr< IMessage > allocateMessage () override
 Allocates a message instance. More...
 
tresult sendMessage (IPtr< IMessage > iMessage) override
 Sends the given message to the peer. More...
 
tresult setParamNormalized (NormalizedState const *iNormalizedState)
 

Protected Attributes

std::vector< ParamID > fAllRegistrationOrder {}
 
std::map< ParamID, std::shared_ptr< IGUIJmbParameter > > fJmbParams {}
 
MessageHandler fMessageHandler {}
 
IMessageProducerfMessageProducer {}
 
ParamAwareViews fParamAwareViews {}
 
Parameters const & fPluginParameters
 
VstParametersSPtr fVstParameters {}
 

Friends

class Debug::ParamDisplay
 

Constructor & Destructor Documentation

◆ GUIState()

GUIState ( Parameters const &  iPluginParameters)
explicit

Member Function Documentation

◆ add()

GUIJmbParam< T > add ( JmbParam< T >  iParamDef)

This method is called for each parameter managed by the GUIState that is not a regular VST parameter.

◆ addJmbParam()

void addJmbParam ( std::shared_ptr< IGUIJmbParameter iParameter)
protected

◆ allocateMessage()

IPtr< IMessage > allocateMessage ( )
overrideprotectedvirtual

Allocates a message instance.

Implements IMessageProducer.

◆ broadcast()

tresult broadcast ( JmbParam< T > const &  iParamDef,
T const &  iMessage 
)

Broadcast a message without requiring the need to instantiate a GUIJmbParam.

◆ connect() [1/2]

std::unique_ptr<FObjectCx> connect ( ParamID  iParamID,
Parameters::IChangeListener iChangeListener 
) const
inline

Connects the paramID to the listener.

The connection object returned automatically closes the connection when it gets destroyed

Returns
nullptr if the parameter does not exist

◆ connect() [2/2]

std::unique_ptr<FObjectCx> connect ( ParamID  iParamID,
Parameters::ChangeCallback  iChangeCallback 
) const
inline

Connects the paramID to the callback.

The connection object returned automatically closes the connection when it gets destroyed

Returns
nullptr if the parameter does not exist

◆ createParamCxMgr()

std::unique_ptr< GUIParamCxMgr > createParamCxMgr ( )

The CustomView class automatically calls this method to get a handle of a ParamCxMgr used to register for interest and obtain GUIParam instances.

See CustomView::registerXXX methods.

◆ existsJmb()

bool existsJmb ( ParamID  iParamID) const
inline
Returns
true if there is a jmb param with the provided ID

◆ existsVst()

bool existsVst ( ParamID  iParamID) const
inline
Returns
true if there is a vst param with the provided ID

◆ findParam()

std::shared_ptr< IGUIParameter > findParam ( ParamID  iParamID) const

Generic call which returns a param with the given id or nullptr if there isn't one.

It can be either a Vst or Jmb param.

◆ getAllRegistrationOrder()

std::vector<ParamID> const& getAllRegistrationOrder ( ) const
inline

◆ getGUIVstParameter() [1/2]

std::shared_ptr< GUIVstParameter< T > > getGUIVstParameter ( ParamID  iParamID) const

◆ getGUIVstParameter() [2/2]

std::shared_ptr<GUIVstParameter<T> > getGUIVstParameter ( VstParam< T >  iParamDef) const
inline

◆ getJmbParameter()

std::shared_ptr< IGUIJmbParameter > getJmbParameter ( ParamID  iParamID) const
Returns
the Jmb parameter given its id (nullptr if not found)

◆ getPluginParameters()

Parameters const& getPluginParameters ( ) const
inline

◆ getRawVstParamDef()

std::shared_ptr<RawVstParamDef> getRawVstParamDef ( ParamID  iParamID) const
inline

◆ getRawVstParameter()

std::shared_ptr<GUIRawVstParameter> getRawVstParameter ( ParamID  iParamID) const
inline
Returns
the raw parameter given its id

◆ handleMessage()

tresult handleMessage ( Message const &  iMessage)
inline

Handle an incoming message => will forward to JmbParam marked shared by rtOwner.

◆ init()

tresult init ( VstParametersSPtr  iVstParameters,
IMessageProducer iMessageProducer 
)
virtual

Called by the GUIController.

◆ makeParamAware()

ParamAwareView<TView>* makeParamAware ( TView *  iView)
inline

Allow for registering an arbitrary callback on an arbitrary view without having to inherit from the view.

The registration will automatically be discarded when the view is deleted.

Example usage:

TextButtonView *button = ....;
fState->makeParamAware(button)->registerCallback<int>(fParams->fMyParam,
  [] (TextButtonView *iButton, GUIVstParam<int> &iParam) {
  iButton->setMouseEnabled(iParam > 3);
});
Template Parameters
TViewshould be a subclass of VSTGUI::CView
Returns
a pointer to an object for registering callbacks, listener and params. Note: You should not keep this pointer around as it be will automatically be deleted when the view goes away.

◆ readGUIState()

tresult readGUIState ( IBStreamer &  iStreamer)
virtual

This method is called from the GUI controller setState method and reads the state previously saved by the GUI only (parameters that are ui only) and initializes the vst host parameters accordingly.

Todo:
handle multiple versions

◆ readRTState()

tresult readRTState ( IBStreamer &  iStreamer)
virtual

This method is called from the GUI controller setComponentState method and reads the state coming from RT and initializes the vst host parameters accordingly.

◆ registerConnectionFor()

ParamAwareView<TView>* registerConnectionFor ( TView *  iView)
inline
Deprecated:
Use makeParamAware instead

◆ sendMessage()

tresult sendMessage ( IPtr< IMessage >  iMessage)
overrideprotectedvirtual

Sends the given message to the peer.

Implements IMessageProducer.

◆ setParamNormalized()

tresult setParamNormalized ( NormalizedState const *  iNormalizedState)
protected

◆ writeGUIState()

tresult writeGUIState ( IBStreamer &  oStreamer) const
virtual

This method is called from the GUI controller getState method and writes the state specific to the GUI only (parameters that are ui only), reading the values from the vst host parameters.

Friends And Related Function Documentation

◆ Debug::ParamDisplay

friend class Debug::ParamDisplay
friend

Member Data Documentation

◆ fAllRegistrationOrder

std::vector<ParamID> fAllRegistrationOrder {}
protected

◆ fJmbParams

std::map<ParamID, std::shared_ptr<IGUIJmbParameter> > fJmbParams {}
protected

◆ fMessageHandler

MessageHandler fMessageHandler {}
protected

◆ fMessageProducer

IMessageProducer* fMessageProducer {}
protected

◆ fParamAwareViews

ParamAwareViews fParamAwareViews {}
protected

◆ fPluginParameters

Parameters const& fPluginParameters
protected

◆ fVstParameters

VstParametersSPtr fVstParameters {}
protected

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