Jamba  3.0.2
pongasoft::VST::GUI::GUIState Class Reference

#include <GUIState.h>

Inherits pongasoft::VST::IMessageProducer.

Inherited by pongasoft::VST::GUI::GUIPluginState< TPluginParameters >.

Public Member Functions

template<typename T >
GUIJmbParam< T > add (JmbParam< T > iParamDef)
 
template<typename T >
tresult broadcast (JmbParam< T > const &iParamDef, T const &iMessage)
 
std::unique_ptr< FObjectCxconnect (ParamID iParamID, Parameters::IChangeListener *iChangeListener) const
 
std::unique_ptr< FObjectCxconnect (ParamID iParamID, Parameters::ChangeCallback iChangeCallback) const
 
std::unique_ptr< GUIParamCxMgrcreateParamCxMgr ()
 
bool existsJmb (ParamID iParamID) const
 
bool existsVst (ParamID iParamID) const
 
std::vector< ParamID > const & getAllRegistrationOrder () const
 
template<typename T >
std::unique_ptr< GUIVstParameter< T > > getGUIVstParameter (ParamID iParamID) const
 
template<typename T >
std::unique_ptr< GUIVstParameter< T > > getGUIVstParameter (VstParam< T > iParamDef) const
 
IGUIJmbParametergetJmbParameter (ParamID iParamID) const
 
Parameters const & getPluginParameters () const
 
std::shared_ptr< RawVstParamDefgetRawVstParamDef (ParamID iParamID) const
 
std::unique_ptr< GUIRawVstParametergetRawVstParameter (ParamID iParamID) const
 
 GUIState (Parameters const &iPluginParameters)
 
tresult handleMessage (Message const &iMessage)
 
virtual tresult init (VstParametersSPtr iVstParameters, IMessageProducer *iMessageProducer)
 
virtual tresult readGUIState (IBStreamer &iStreamer)
 
virtual tresult readRTState (IBStreamer &iStreamer)
 
template<typename TView >
ViewGUIParamCxAware< TView > * registerConnectionFor (TView *iView)
 
virtual tresult writeGUIState (IBStreamer &oStreamer) const
 
- Public Member Functions inherited from pongasoft::VST::IMessageProducer
virtual ~IMessageProducer ()=default
 

Protected Member Functions

void addJmbParam (std::unique_ptr< IGUIJmbParameter > iParameter)
 
IPtr< IMessage > allocateMessage () override
 
tresult sendMessage (IPtr< IMessage > iMessage) override
 
tresult setParamNormalized (NormalizedState const *iNormalizedState)
 

Protected Attributes

std::vector< ParamID > fAllRegistrationOrder {}
 
std::map< ParamID, std::unique_ptr< IGUIJmbParameter > > fJmbParams {}
 
MessageHandler fMessageHandler {}
 
IMessageProducerfMessageProducer {}
 
Parameters const & fPluginParameters
 
ViewCxMgr fViewCxMgr {}
 
VstParametersSPtr fVstParameters {}
 

Friends

class Debug::ParamDisplay
 

Constructor & Destructor Documentation

◆ GUIState()

pongasoft::VST::GUI::GUIState::GUIState ( Parameters const &  iPluginParameters)
explicit

Member Function Documentation

◆ add()

template<typename T >
GUIJmbParam< T > pongasoft::VST::GUI::GUIState::add ( JmbParam< T >  iParamDef)

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

◆ addJmbParam()

void pongasoft::VST::GUI::GUIState::addJmbParam ( std::unique_ptr< IGUIJmbParameter iParameter)
protected

◆ allocateMessage()

IPtr< IMessage > pongasoft::VST::GUI::GUIState::allocateMessage ( )
overrideprotectedvirtual

Allocates a message instance

Implements pongasoft::VST::IMessageProducer.

◆ broadcast()

template<typename T >
tresult pongasoft::VST::GUI::GUIState::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> pongasoft::VST::GUI::GUIState::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> pongasoft::VST::GUI::GUIState::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 > pongasoft::VST::GUI::GUIState::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 pongasoft::VST::GUI::GUIState::existsJmb ( ParamID  iParamID) const
inline
Returns
true if there is a ser param with the provided ID

◆ existsVst()

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

◆ getAllRegistrationOrder()

std::vector<ParamID> const& pongasoft::VST::GUI::GUIState::getAllRegistrationOrder ( ) const
inline

◆ getGUIVstParameter() [1/2]

template<typename T >
std::unique_ptr< GUIVstParameter< T > > pongasoft::VST::GUI::GUIState::getGUIVstParameter ( ParamID  iParamID) const

◆ getGUIVstParameter() [2/2]

template<typename T >
std::unique_ptr<GUIVstParameter<T> > pongasoft::VST::GUI::GUIState::getGUIVstParameter ( VstParam< T >  iParamDef) const
inline

◆ getJmbParameter()

IGUIJmbParameter * pongasoft::VST::GUI::GUIState::getJmbParameter ( ParamID  iParamID) const
Returns
the Jmb parameter given its id (nullptr if not found)

◆ getPluginParameters()

Parameters const& pongasoft::VST::GUI::GUIState::getPluginParameters ( ) const
inline

◆ getRawVstParamDef()

std::shared_ptr<RawVstParamDef> pongasoft::VST::GUI::GUIState::getRawVstParamDef ( ParamID  iParamID) const
inline

◆ getRawVstParameter()

std::unique_ptr<GUIRawVstParameter> pongasoft::VST::GUI::GUIState::getRawVstParameter ( ParamID  iParamID) const
inline
Returns
the raw parameter given its id

◆ handleMessage()

tresult pongasoft::VST::GUI::GUIState::handleMessage ( Message const &  iMessage)
inline

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

◆ init()

tresult pongasoft::VST::GUI::GUIState::init ( VstParametersSPtr  iVstParameters,
IMessageProducer iMessageProducer 
)
virtual

Called by the GUIController.

◆ readGUIState()

tresult pongasoft::VST::GUI::GUIState::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 pongasoft::VST::GUI::GUIState::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()

template<typename TView >
ViewGUIParamCxAware<TView>* pongasoft::VST::GUI::GUIState::registerConnectionFor ( 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->registerConnectionFor(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.

◆ sendMessage()

tresult pongasoft::VST::GUI::GUIState::sendMessage ( IPtr< IMessage >  iMessage)
overrideprotectedvirtual

Sends the given message to the peer.

Implements pongasoft::VST::IMessageProducer.

◆ setParamNormalized()

tresult pongasoft::VST::GUI::GUIState::setParamNormalized ( NormalizedState const *  iNormalizedState)
protected

◆ writeGUIState()

tresult pongasoft::VST::GUI::GUIState::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> pongasoft::VST::GUI::GUIState::fAllRegistrationOrder {}
protected

◆ fJmbParams

std::map<ParamID, std::unique_ptr<IGUIJmbParameter> > pongasoft::VST::GUI::GUIState::fJmbParams {}
protected

◆ fMessageHandler

MessageHandler pongasoft::VST::GUI::GUIState::fMessageHandler {}
protected

◆ fMessageProducer

IMessageProducer* pongasoft::VST::GUI::GUIState::fMessageProducer {}
protected

◆ fPluginParameters

Parameters const& pongasoft::VST::GUI::GUIState::fPluginParameters
protected

◆ fViewCxMgr

ViewCxMgr pongasoft::VST::GUI::GUIState::fViewCxMgr {}
protected

◆ fVstParameters

VstParametersSPtr pongasoft::VST::GUI::GUIState::fVstParameters {}
protected

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