Jamba C++ API  4.0.0
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) More...
 
using ValueAccessor = std::function< void(T const &)>
 API to access the value of the param. More...
 

Public Member Functions

tresult accessValue (typename ITGUIParameter< T >::ValueAccessor const &iGetter) const override
 
std::shared_ptr< GUIDiscreteParameterasDiscreteParameter (int32 iStepCount) override
 Converts this parameter into a discrete parameter. More...
 
std::unique_ptr< FObjectCxconnect (Parameters::IChangeListener *iChangeListener) const override
 
std::unique_ptr< FObjectCxconnect (Parameters::ChangeCallback iChangeCallback) const override
 
std::unique_ptr< EditorTypeedit () override
 Creates an editor to modify the parameter in a transactional fashion. More...
 
JmbParamDef< T > const * getParamDefT () const
 
ParamID getParamID () const override
 Each parameter has a unique ID returned by this method. More...
 
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). More...
 
ParamType const & getValue () const
 
ParamTypegetValue ()
 
 GUIJmbParameter (std::shared_ptr< JmbParamDef< T >> iParamDef)
 
tresult readFromMessage (Message const &iMessage) override
 
tresult readFromStream (IBStreamer &iStreamer) override
 
void resetToDefault ()
 Resets the param to its default value. More...
 
tresult setValue (ParamType const &iValue) override
 Sets the value. More...
 
tresult setValue (ParamType &&iValue)
 Sets the value. More...
 
std::string toUTF8String (int32 iPrecision) const override
 Returns the current value of the parameter as a string (which is properly UTF-8 encoded). More...
 
bool update (ParamType const &iValue) override
 Update the parameter with a value. More...
 
template<class ValueModifier >
bool updateIf (ValueModifier const &iValueModifier)
 Use this flavor of update if you want to modify the value itself. More...
 
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. More...
 
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. More...
 
- Public Member Functions inherited from IGUIParameter
template<typename T >
std::shared_ptr< ITGUIParameter< T > > cast ()
 Downcasts this parameter into a typed version. More...
 
- 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

using EditorType = typename ITGUIParameter<T>::ITEditor

◆ ParamType

using ParamType = T

Constructor & Destructor Documentation

◆ GUIJmbParameter()

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

◆ ~GUIJmbParameter()

~GUIJmbParameter ( )
inlineoverride

Member Function Documentation

◆ accessValue()

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

◆ asDiscreteParameter()

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]

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

Implements IGUIParameter.

◆ connect() [2/2]

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

Implements IGUIParameter.

◆ edit()

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()

JmbParamDef<T> const* getParamDefT ( ) const
inline

◆ getParamID()

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()

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]

ParamType const& getValue ( ) const
inline

◆ getValue() [2/2]

ParamType& getValue ( )
inline

◆ readFromMessage()

tresult readFromMessage ( Message const &  iMessage)
inlineoverridevirtual

Implements IGUIJmbParameter.

◆ readFromStream()

tresult readFromStream ( IBStreamer &  iStreamer)
inlineoverridevirtual

Implements IGUIJmbParameter.

◆ resetToDefault()

void resetToDefault ( )
inline

Resets the param to its default value.

◆ setValue() [1/2]

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 >.

◆ setValue() [2/2]

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)

◆ toUTF8String()

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()

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()

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()

tresult writeToMessage ( Message oMessage) const
inlineoverridevirtual

Implements IGUIJmbParameter.

◆ writeToStream() [1/2]

tresult writeToStream ( IBStreamer &  oStreamer) const
inlineoverridevirtual

Implements IGUIJmbParameter.

◆ writeToStream() [2/2]

void writeToStream ( std::ostream &  oStream) const
inlineoverridevirtual

Implements IGUIJmbParameter.

Member Data Documentation

◆ fValue

ParamType fValue
protected

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