Jamba C++ API  4.0.0
ITGUIParameter< T > Class Template Referenceabstract

Represents a gui parameter with its underlying backing type T (aka ParamType). More...

#include <IGUIParameter.h>

Inherits IGUIParameter.

Inherited by GUIJmbParameter< T >, GUIValParameter< T >, and GUIVstParameter< T >.

Classes

class  ITEditor
 Defines the API for the editor which can be obtained by calling ITGUIParameter::edit(). More...
 

Public Types

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

virtual tresult accessValue (ValueAccessor const &iGetter) const =0
 API to access the underlying value. More...
 
virtual std::unique_ptr< ITEditoredit ()=0
 Creates an editor to modify the parameter in a transactional fashion. 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...
 
virtual tresult setValue (ParamType const &iValue)=0
 Unconditionaly sets the value of the parameter to the value provided. More...
 
virtual bool update (ParamType const &iValue)=0
 First check if the value provided (iValue) is different from the current value and if that is the case then updates it to the new value. More...
 
- Public Member Functions inherited from IGUIParameter
virtual std::shared_ptr< GUIDiscreteParameterasDiscreteParameter (int32 iStepCount)=0
 Converts this parameter into a discrete parameter. More...
 
template<typename T >
std::shared_ptr< ITGUIParameter< T > > cast ()
 Downcasts this parameter into a typed version. More...
 
virtual std::unique_ptr< FObjectCxconnect (Parameters::IChangeListener *iChangeListener) const =0
 Creates a connection between this parameter and the change listener: whenever the parameter changes, the listener will be notified of the changes (Parameters::IChangeListener::onParameterChange(ParamID)). More...
 
virtual std::unique_ptr< FObjectCxconnect (Parameters::ChangeCallback iChangeCallback) const =0
 Creates a connection between this parameter and the callback: whenever the parameter changes, the callback will be invoked (std::function<void()>). More...
 
virtual ParamID getParamID () const =0
 Each parameter has a unique ID returned by this method. More...
 
virtual int32 getStepCount () const =0
 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...
 
virtual std::string toUTF8String (int32 iPrecision) const =0
 Returns the current value of the parameter as a string (which is properly UTF-8 encoded). More...
 

Detailed Description

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

Represents a gui parameter with its underlying backing type T (aka ParamType).

Since we know the ParamType, this subclass of IGUIParameter adds the basic manipulation methods to deal with the parameter.

Template Parameters
Tthe underlying backing type (aka ParamType).

Member Typedef Documentation

◆ ParamType

using ParamType = T

The type of the param (alias)

◆ ValueAccessor

using ValueAccessor = std::function<void(T const &)>

API to access the value of the param.

See also
accessValue(ValueAccessor const &) const

Member Function Documentation

◆ accessValue()

virtual tresult accessValue ( ValueAccessor const &  iGetter) const
pure virtual

API to access the underlying value.

getValue() has a different api depending on the type of param (Vst and Jmb). As a result this interface only provides a common way to access it in both cases via an accessor which allows to:

  • avoid copy in the case of Jmb
  • avoid duplicating values in the case of Vst
Returns
kResultOk if the getter is called, and kResultFalse if the getter is not called for some reason

Implemented in GUIDiscreteJmbParameter< T >, and GUIRawVstParameter.

◆ edit() [1/2]

virtual std::unique_ptr<ITEditor> edit ( )
pure virtual

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

See also
ITGUIParameter::ITEditor

Implemented in GUIDiscreteJmbParameter< T >, GUIJmbParameter< T >, GUIVstParameter< T >, GUIRawVstParameter, GUIValParameter< T >, and GUIValParameter< int32 >.

◆ edit() [2/2]

virtual std::unique_ptr<ITEditor> edit ( ParamType const &  iValue)
inlinevirtual

Shortcut api which creates an editor followed by ITEditor::setValue(ParamType const &) to set the parameter value to iValue.

◆ setValue()

virtual tresult setValue ( ParamType const &  iValue)
pure virtual

Unconditionaly sets the value of the parameter to the value provided.

Parameters
iValuethe value to set
Returns
kResultOk if successful

Implemented in GUIDiscreteJmbParameter< T >, GUIRawVstParameter, GUIVstParameter< T >, GUIJmbParameter< T >, GUIValParameter< T >, and GUIValParameter< int32 >.

◆ update()

virtual bool update ( ParamType const &  iValue)
pure virtual

First check if the value provided (iValue) is different from the current value and if that is the case then updates it to the new value.

Note
If the type T does not provide a way to compare the value, then this call will delegate to setValue(ParamType const &) and return true.
Parameters
iValuethe value to update
Returns
true if the value was updated

Implemented in GUIDiscreteJmbParameter< T >, GUIRawVstParameter, GUIVstParameter< T >, GUIJmbParameter< T >, GUIValParameter< T >, and GUIValParameter< int32 >.


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