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

This is the main class that the plugin should use as it exposes only the necessary methods of the param as well as redefine a couple of operators which helps in writing simpler and natural code (the param behaves like T in many ways). More...

#include <GUIVstParameter.h>

Inherits Dereferenceable< GUIVstParam< T > >.

Classes

class  Value
 The purpose of this class is to copy the value so that it can be accessed via -> thus allowing to write param->x to access the underlying type (T) when it is a struct or a class. More...

Public Types

using Editor = std::unique_ptr<EditorType>
using EditorType = typename GUIVstParameter<T>::ITEditor
using ParamType = T

Public Member Functions

std::unique_ptr< FObjectCx > connect (Parameters::ChangeCallback iChangeCallback) const
std::unique_ptr< FObjectCx > connect (Parameters::IChangeListener *iChangeListener) const
 Allow to write param1 == param2.
tresult copyValueFrom (GUIRawVstParam const &iParam)
 Shortcut to copy the value from another param to this one (raw value).
template<typename V>
tresult copyValueFrom (GUIVstParam< V > const &iParam)
 Shortcut to copy the value from another param to this one.
Editor edit ()
Editor edit (T const &iValue)
 Shortcut to create an editor and set the value to it.
bool exists () const
ParamValue getNormalizedValue () const
ParamID getParamID () const
int32 getStepCount () const
T getValue () const
 GUIVstParam (std::shared_ptr< GUIVstParameter< T > > iPtr=nullptr)
 operator T () const
 Allow to use the param as the underlying ParamType (ex: if(param) in the case ParamType is bool)).
constexpr T operator* () const
 allow writing *param to access the underlying value (or in other words, *param is the same param.value())
constexpr Value operator-> () const
 allow writing param->x to access the underlying value when T is a struct or class
GUIVstParam< T > & operator= (GUIVstParam< T > const &iOther)=default
 Assignment operator: fMyParam = registerParam(...);.
GUIVstParam< T > & operator= (T const &iValue)
 Allow to write param = 3.0.
tresult resetToDefault ()
 Resets the param to its default value.
tresult setNormalizedValue (ParamValue const &iNormalizedValue)
 Sets the value of this parameter as a normalized value.
tresult setValue (T const &iValue)
 Sets the value of this parameter.
Steinberg::String toString ()
 Returns a string representation of this parameter.
void toString (String128 oString)
 Populates the oString with a string representation of this parameter.
std::string toUTF8String (int32 iPrecision) const
 Returns the current value of the parameter as a string (which is properly UTF-8 encoded).
bool update (T const &iValue)
 Update the parameter with a value.
T value () const
 Synonym to getValue().

Private Attributes

std::shared_ptr< GUIVstParameter< T > > fPtr

Detailed Description

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

This is the main class that the plugin should use as it exposes only the necessary methods of the param as well as redefine a couple of operators which helps in writing simpler and natural code (the param behaves like T in many ways).

Template Parameters
Tthe underlying type of the param

Member Typedef Documentation

◆ Editor

template<typename T>
using Editor = std::unique_ptr<EditorType>

◆ EditorType

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

◆ ParamType

template<typename T>
using ParamType = T

Constructor & Destructor Documentation

◆ GUIVstParam()

template<typename T>
GUIVstParam ( std::shared_ptr< GUIVstParameter< T > > iPtr = nullptr)
inline

Member Function Documentation

◆ connect() [1/2]

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

◆ connect() [2/2]

template<typename T>
std::unique_ptr< FObjectCx > connect ( Parameters::IChangeListener * iChangeListener) const
inline

Allow to write param1 == param2.

Returns
an object maintaining the connection between the parameter and the listener

◆ copyValueFrom() [1/2]

template<typename T>
tresult copyValueFrom ( GUIRawVstParam const & iParam)
inline

Shortcut to copy the value from another param to this one (raw value).

◆ copyValueFrom() [2/2]

template<typename T>
template<typename V>
tresult copyValueFrom ( GUIVstParam< V > const & iParam)
inline

Shortcut to copy the value from another param to this one.

Implementation note: uses normalized value as this is faster and avoid math precision loss in normalize/denormalize

◆ edit() [1/2]

template<typename T>
Editor edit ( )
inline
Returns
an editor to modify the parameter (see Editor)

◆ edit() [2/2]

template<typename T>
Editor edit ( T const & iValue)
inline

Shortcut to create an editor and set the value to it.

Returns
an editor to modify the parameter (see Editor)

◆ exists()

template<typename T>
bool exists ( ) const
inline

◆ getNormalizedValue()

template<typename T>
ParamValue getNormalizedValue ( ) const
inline
Returns
the current value of the parameter as a normalized value

◆ getParamID()

template<typename T>
ParamID getParamID ( ) const
inline

◆ getStepCount()

template<typename T>
int32 getStepCount ( ) const
inline
Returns
number of steps (for discrete param) or 0 for continuous

◆ getValue()

template<typename T>
T getValue ( ) const
inline
Returns
the current value of the parameter as a T (using the Denormalizer)

◆ operator T()

template<typename T>
operator T ( ) const
inline

Allow to use the param as the underlying ParamType (ex: if(param) in the case ParamType is bool)).

◆ operator*()

template<typename T>
T operator* ( ) const
inlineconstexpr

allow writing *param to access the underlying value (or in other words, *param is the same param.value())

◆ operator->()

template<typename T>
Value operator-> ( ) const
inlineconstexpr

allow writing param->x to access the underlying value when T is a struct or class

◆ operator=() [1/2]

template<typename T>
GUIVstParam< T > & operator= ( GUIVstParam< T > const & iOther)
default

Assignment operator: fMyParam = registerParam(...);.

◆ operator=() [2/2]

template<typename T>
GUIVstParam< T > & operator= ( T const & iValue)
inline

Allow to write param = 3.0.

◆ resetToDefault()

template<typename T>
tresult resetToDefault ( )
inline

Resets the param to its default value.

◆ setNormalizedValue()

template<typename T>
tresult setNormalizedValue ( ParamValue const & iNormalizedValue)
inline

Sets the value of this parameter as a normalized value.

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

◆ setValue()

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

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

◆ toString() [1/2]

template<typename T>
Steinberg::String toString ( )
inline

Returns a string representation of this parameter.

◆ toString() [2/2]

template<typename T>
void toString ( String128 oString)
inline

Populates the oString with a string representation of this parameter.

◆ toUTF8String()

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

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

◆ update()

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

Update the parameter with a value.

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

◆ value()

template<typename T>
T value ( ) const
inline

Synonym to getValue().

Member Data Documentation

◆ fPtr

template<typename T>
std::shared_ptr<GUIVstParameter<T> > fPtr
private

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