Jamba C++ API 7.5.0
Loading...
Searching...
No Matches
GUIJmbParameter< T > Class Template Reference

This is the templated version providing serializer methods, very similar to the GUIVstParameter concept. More...

#include <GUIJmbParameter.h>

Inherits ITGUIParameter< T >, IGUIJmbParameter, and FObject.

Public Types

using EditorType = typename ITGUIParameter<T>::ITEditor
using ParamType = T
Public Types inherited from ITGUIParameter< T >
using ParamType = T
 The type of the param (alias).
using ValueAccessor = std::function<void(T const &)>
 API to access the value of the param.

Public Member Functions

tresult accessValue (typename ITGUIParameter< T >::ValueAccessor const &iGetter) const override
std::shared_ptr< GUIDiscreteParameter > asDiscreteParameter (int32 iStepCount) override
 Converts this parameter into a discrete parameter.
std::unique_ptr< FObjectCxconnect (Parameters::ChangeCallback iChangeCallback) const override
std::unique_ptr< FObjectCxconnect (Parameters::IChangeListener *iChangeListener) const override
std::unique_ptr< EditorTypeedit () override
 Creates an editor to modify the parameter in a transactional fashion.
JmbParamDef< T > const * getParamDefT () const
ParamID getParamID () const override
 Each parameter has a unique ID returned by this method.
int32 getStepCount () const override
 When a parameter is a discrete parameter (which means its underlying backing type is an int32 with values in the discrete range [0, getStepCount()]), this method will return the number of steps (> 0).
ParamTypegetValue ()
ParamType const & getValue () const
 GUIJmbParameter (std::shared_ptr< JmbParamDef< T > > iParamDef)
tresult readFromMessage (Message const &iMessage) override
tresult readFromStream (IBStreamer &iStreamer) override
tresult resetToDefault () override
 Resets the param to its default value.
tresult setValue (ParamType &&iValue)
 Sets the value.
tresult setValue (ParamType const &iValue) override
 Sets the value.
std::string toUTF8String (int32 iPrecision) const override
 Returns the current value of the parameter as a string (which is properly UTF-8 encoded).
bool update (ParamType const &iValue) override
 Update the parameter with a value.
template<class ValueModifier>
bool updateIf (ValueModifier const &iValueModifier)
 Use this flavor of update if you want to modify the value itself.
tresult writeToMessage (Message &oMessage) const override
tresult writeToStream (IBStreamer &oStreamer) const override
void writeToStream (std::ostream &oStream) const override
 ~GUIJmbParameter () override
Public Member Functions inherited from ITGUIParameter< T >
virtual tresult accessValue (ValueAccessor const &iGetter) const =0
 API to access the underlying value.
virtual std::unique_ptr< ITEditoredit (ParamType const &iValue)
 Shortcut api which creates an editor followed by ITEditor::setValue(ParamType const &) to set the parameter value to iValue.
Public Member Functions inherited from IGUIParameter
template<typename T>
std::shared_ptr< ITGUIParameter< T > > cast ()
 Downcasts this parameter into a typed version.
Public Member Functions inherited from IGUIJmbParameter
tresult broadcast () const
ParamID getJmbParamID () const
IJmbParamDef const * getParamDef () const
tresult handleMessage (Message const &iMessage) override
 IGUIJmbParameter (std::shared_ptr< IJmbParamDef > iParamDef)
void setMessageProducer (IMessageProducer *iMessageProducer)
Public Member Functions inherited from IMessageHandler
virtual ~IMessageHandler ()=default

Protected Attributes

ParamType fValue
Protected Attributes inherited from IGUIJmbParameter
IMessageProducerfMessageProducer {}
std::shared_ptr< IJmbParamDeffParamDef

Detailed Description

template<typename T>
class pongasoft::VST::GUI::Params::GUIJmbParameter< T >

This is the templated version providing serializer methods, very similar to the GUIVstParameter concept.

Template Parameters
Tthe underlying type of the param

Member Typedef Documentation

◆ EditorType

template<typename T>
using EditorType = typename ITGUIParameter<T>::ITEditor

◆ ParamType

template<typename T>
using ParamType = T

Constructor & Destructor Documentation

◆ GUIJmbParameter()

template<typename T>
GUIJmbParameter ( std::shared_ptr< JmbParamDef< T > > iParamDef)
inlineexplicit

◆ ~GUIJmbParameter()

template<typename T>
~GUIJmbParameter ( )
inlineoverride

Member Function Documentation

◆ accessValue()

template<typename T>
tresult accessValue ( typename ITGUIParameter< T >::ValueAccessor const & iGetter) const
inlineoverride

◆ asDiscreteParameter()

template<typename T>
std::shared_ptr< GUIDiscreteParameter > asDiscreteParameter ( int32 iStepCount)
overridevirtual

Converts this parameter into a discrete parameter.

The discrete parameter returned is a parameter with an underlying backing type int32 and values in the discrete range [0, getStepCount()] or [0, iStepCount] if getStepCount() <= 0.

Parameters
iStepCountif this parameter already defines a step count (getStepCount() > 0), then this parameter is ignored, otherwise it is used to convert this parameter into a discrete parameter with iStepCount steps.
Returns
the discrete parameter or nullptr if this parameter cannot be converted to a discrete parameter.

Implements IGUIParameter.

◆ connect() [1/2]

template<typename T>
std::unique_ptr< FObjectCx > connect ( Parameters::ChangeCallback iChangeCallback) const
inlineoverridevirtual
Returns
a connection that will listen to parameter changes (see GUIParamCx)

Implements IGUIParameter.

◆ connect() [2/2]

template<typename T>
std::unique_ptr< FObjectCx > connect ( Parameters::IChangeListener * iChangeListener) const
inlineoverridevirtual
Returns
a connection that will listen to parameter changes (see GUIParamCx)

Implements IGUIParameter.

◆ edit()

template<typename T>
std::unique_ptr< EditorType > edit ( )
inlineoverridevirtual

Creates an editor to modify the parameter in a transactional fashion.

See also
ITGUIParameter::ITEditor

Implements ITGUIParameter< T >.

◆ getParamDefT()

template<typename T>
JmbParamDef< T > const * getParamDefT ( ) const
inline

◆ getParamID()

template<typename T>
ParamID getParamID ( ) const
inlineoverridevirtual

Each parameter has a unique ID returned by this method.

Note
Some parameters (in particular GUIOptionalParam) may return pongasoft::VST::UNDEFINED_PARAM_ID

Implements IGUIParameter.

◆ getStepCount()

template<typename T>
int32 getStepCount ( ) const
inlineoverridevirtual

When a parameter is a discrete parameter (which means its underlying backing type is an int32 with values in the discrete range [0, getStepCount()]), this method will return the number of steps (> 0).

Note
Although a parameter may not be a discrete parameter itself, the method asDiscreteParameter(int32) may be able to convert/adapt it to one.
Returns
the number of steps which is > 0 if and only if this parameter is a discrete parameter.

Implements IGUIParameter.

◆ getValue() [1/2]

template<typename T>
ParamType & getValue ( )
inline

◆ getValue() [2/2]

template<typename T>
ParamType const & getValue ( ) const
inline

◆ readFromMessage()

template<typename T>
tresult readFromMessage ( Message const & iMessage)
inlineoverridevirtual

Implements IGUIJmbParameter.

◆ readFromStream()

template<typename T>
tresult readFromStream ( IBStreamer & iStreamer)
inlineoverridevirtual

Implements IGUIJmbParameter.

◆ resetToDefault()

template<typename T>
tresult resetToDefault ( )
inlineoverridevirtual

Resets the param to its default value.

Implements IGUIParameter.

◆ setValue() [1/2]

template<typename T>
tresult setValue ( ParamType && iValue)
inline

Sets the value.

The difference with update is that it does not check for equality (case when ParamType is not comparable)

◆ setValue() [2/2]

template<typename T>
tresult setValue ( ParamType const & iValue)
inlineoverridevirtual

Sets the value.

The difference with update is that it does not check for equality (case when ParamType is not comparable)

Implements ITGUIParameter< T >.

◆ toUTF8String()

template<typename T>
std::string toUTF8String ( int32 iPrecision) const
inlineoverridevirtual

Returns the current value of the parameter as a string (which is properly UTF-8 encoded).

Parameters
iPrecisionif iPrecision < 0 the parameter is free to use whichever precision is tied to the parameter otherwise it should use the one provided

Implements IGUIParameter.

◆ update()

template<typename T>
bool update ( ParamType const & iValue)
inlineoverridevirtual

Update the parameter with a value.

Returns
true if the value was actually updated, false if it is the same

Implements ITGUIParameter< T >.

◆ updateIf()

template<typename T>
template<class ValueModifier>
bool updateIf ( ValueModifier const & iValueModifier)
inline

Use this flavor of update if you want to modify the value itself.

ValueModifier will be called back with &fValue (of type T *). The callback should return true when the value was updated, false otherwise

◆ writeToMessage()

template<typename T>
tresult writeToMessage ( Message & oMessage) const
inlineoverridevirtual

Implements IGUIJmbParameter.

◆ writeToStream() [1/2]

template<typename T>
tresult writeToStream ( IBStreamer & oStreamer) const
inlineoverridevirtual

Implements IGUIJmbParameter.

◆ writeToStream() [2/2]

template<typename T>
void writeToStream ( std::ostream & oStream) const
inlineoverridevirtual

Implements IGUIJmbParameter.

Member Data Documentation

◆ fValue

template<typename T>
ParamType fValue
protected

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