Jamba C++ API  4.0.0
GUIRawVstParameter Class Reference

Encapsulates a vst parameter and how to access it (read/write) as well as how to "connect" to it in order to be notified of changes. More...

#include <GUIRawVstParameter.h>

Inherits ITGUIParameter< ParamValue >.

Classes

class  Editor
 Wrapper to edit a single parameter. More...
 

Public Types

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

Public Member Functions

tresult accessValue (ValueAccessor const &iGetter) const override
 API to access the underlying value. More...
 
std::shared_ptr< GUIDiscreteParameterasDiscreteParameter (int32 iStepCount) override
 This implementation will adapt this parameter to be interpreted as a discrete parameter. More...
 
template<typename T >
std::shared_ptr< GUIVstParameter< T > > asVstParameter ()
 Converts to a typed 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
 
ParamID getParamID () const override
 Each parameter has a unique ID returned by this method. More...
 
int32 getStepCount () const override
 
ParamValue getValue () const
 
 GUIRawVstParameter (ParamID iParamID, VstParametersSPtr iVstParameters, std::shared_ptr< RawVstParamDef > iParamDef)
 
tresult setValue (ParamValue const &iValue) override
 Sets the value of this parameter. More...
 
void toString (String128 oString)
 Populates the oString with a string representation of this parameter. More...
 
String toString ()
 Returns a string representation of this parameter. 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 (ParamValue const &iValue) override
 Update the parameter with a value. More...
 
 ~GUIRawVstParameter ()=default
 
- Public Member Functions inherited from ITGUIParameter< ParamValue >
virtual std::unique_ptr< ITEditor > edit (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...
 

Private Attributes

std::shared_ptr< RawVstParamDeffParamDef
 
ParamID fParamID
 
VstParametersSPtr fVstParameters
 

Detailed Description

Encapsulates a vst parameter and how to access it (read/write) as well as how to "connect" to it in order to be notified of changes.

This "raw" version deals with ParamValue which is the underlying type used by the vst sdk which is always a number in the range [0.0, 1.0]. The class VSTParameter deals with other types and automatic normalization/denormalization.

Member Typedef Documentation

◆ EditorType

using EditorType = ITGUIParameter<ParamValue>::ITEditor

◆ ParamType

using ParamType = ParamValue

Constructor & Destructor Documentation

◆ GUIRawVstParameter()

GUIRawVstParameter ( ParamID  iParamID,
VstParametersSPtr  iVstParameters,
std::shared_ptr< RawVstParamDef iParamDef 
)

◆ ~GUIRawVstParameter()

~GUIRawVstParameter ( )
default

Member Function Documentation

◆ accessValue()

tresult accessValue ( ValueAccessor const &  iGetter) const
inlineoverridevirtual

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

Implements ITGUIParameter< ParamValue >.

◆ asDiscreteParameter()

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

This implementation will adapt this parameter to be interpreted as a discrete parameter.

If it is already a discrete parameter, then iStepCount is ignored. Otherwise, if iStepCount is > 0, then the parameter will be adapted to be handled as a discrete parameter with iStepCount steps even if it is not. For example, if you have a parameter representing a gain value (which is not a discrete value), it can still be used with a DiscreteButtonView so you can split the range into discrete values and have a button for each.

Implements IGUIParameter.

◆ asVstParameter()

std::shared_ptr< GUIVstParameter< T > > asVstParameter ( )

Converts to a typed parameter.

Returns
nullptr if the underlying parameter is not of proper type

◆ connect() [1/2]

std::unique_ptr<FObjectCx> connect ( Parameters::IChangeListener iChangeListener) const
inlineoverridevirtual
Returns
an object maintaining the connection between the parameter and the listener

Implements IGUIParameter.

◆ connect() [2/2]

std::unique_ptr<FObjectCx> connect ( Parameters::ChangeCallback  iChangeCallback) const
inlineoverridevirtual
Returns
an object maintaining the connection between the parameter and the callback

Implements IGUIParameter.

◆ edit()

std::unique_ptr<EditorType> edit ( )
inlineoverridevirtual
Returns
an editor to modify the parameter (see Editor)

Implements ITGUIParameter< ParamValue >.

◆ 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
Returns
number of steps (for discrete param) or 0 for continuous

Implements IGUIParameter.

◆ getValue()

ParamValue getValue ( ) const
inline
Returns
the current raw value of the parameter

◆ setValue()

tresult setValue ( ParamValue const &  iValue)
inlineoverridevirtual

Sets the value of this parameter.

Note that this is "transactional" and if you want to make further changes that spans multiple calls (ex: onMouseDown / onMouseMoved / onMouseUp) you should use an editor

Implements ITGUIParameter< ParamValue >.

◆ toString() [1/2]

void toString ( String128  oString)
inline

Populates the oString with a string representation of this parameter.

◆ toString() [2/2]

String toString ( )
inline

Returns a string representation of this parameter.

◆ 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 ( ParamValue 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< ParamValue >.

Member Data Documentation

◆ fParamDef

std::shared_ptr<RawVstParamDef> fParamDef
private

◆ fParamID

ParamID fParamID
private

◆ fVstParameters

VstParametersSPtr fVstParameters
private

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