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

This parameter is not tied to any parameter definition/registration and is primarily used by the optional parameter. More...

#include <GUIValParameter.h>

Inherits ITGUIParameter< T >, 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
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
 GUIValParameter (ParamID iParamID, ParamType const &iDefaultValue)
tresult resetToDefault () override
 Resets the param to its default value.
void setParamID (ParamID iParamID)
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.
 ~GUIValParameter () 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.

Protected Attributes

fDefaultValue
ParamID fParamID
fValue

Detailed Description

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

This parameter is not tied to any parameter definition/registration and is primarily used by the optional parameter.

Private API
This is part of the internal/private API of Jamba and should not be used directly.

Member Typedef Documentation

◆ EditorType

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

◆ ParamType

template<typename T>
using ParamType = T

Constructor & Destructor Documentation

◆ GUIValParameter()

template<typename T>
GUIValParameter ( ParamID iParamID,
ParamType const & iDefaultValue )
inlineexplicit

◆ ~GUIValParameter()

template<typename T>
~GUIValParameter ( )
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
Returns
an editor to edit modify the value

Implements ITGUIParameter< T >.

◆ 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

◆ resetToDefault()

template<typename T>
tresult resetToDefault ( )
inlineoverridevirtual

Resets the param to its default value.

Implements IGUIParameter.

◆ setParamID()

template<typename T>
void setParamID ( ParamID iParamID)
inline

◆ setValue()

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

Member Data Documentation

◆ fDefaultValue

template<typename T>
T fDefaultValue
protected

◆ fParamID

template<typename T>
ParamID fParamID
protected

◆ fValue

template<typename T>
T fValue
protected

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