Jamba C++ API
4.0.0
|
Represents an optional parameter (Jmb, Vst or no param at all). More...
#include <GUIOptionalParam.h>
Public Types | |
using | class_type = GUIOptionalParam< T > |
using | EditorType = typename ITGUIParameter< T >::ITEditor |
using | ParamType = T |
Public Member Functions | |
std::unique_ptr< FObjectCx > | connect (Parameters::IChangeListener *iChangeListener) const |
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... | |
std::unique_ptr< FObjectCx > | connect (Parameters::ChangeCallback iChangeCallback) const |
Creates a connection between this parameter and the callback: whenever the parameter changes, the callback will be invoked (std::function<void()> ). More... | |
std::unique_ptr< EditorType > | edit () |
Creates an editor to modify the parameter in a transactional fashion. More... | |
std::unique_ptr< EditorType > | edit (ParamType const &iValue) |
Shortcut api which creates an editor followed by ITEditor::setValue(ParamType const &) to set the parameter value to iValue . More... | |
bool | exists () const |
Always return true because by definition an optional parameter always exist. More... | |
ParamID | getParamID () const |
Each parameter has a unique ID returned by this method. More... | |
int32 | getStepCount () const |
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 | getValue () const |
GUIOptionalParam () | |
GUIOptionalParam (T const &iDefaultValue) | |
GUIOptionalParam (std::shared_ptr< ITGUIParameter< T >> iParameter) | |
operator T () const | |
Allow to use the param as the underlying ParamType . More... | |
bool | operator!= (const class_type &rhs) const |
Allow to write param1 != param2 to compare the underlying values. More... | |
GUIOptionalParam & | operator= (T const &iValue) |
Allow to write param = 3 instead of param.update(3) for example. More... | |
bool | operator== (const class_type &rhs) const |
Allow to write param1 == param2 to compare the underlying values. More... | |
tresult | setValue (ParamType const &iValue) |
Unconditionaly sets the value of the parameter to the value provided. More... | |
bool | update (ParamType const &iValue) |
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... | |
Private Attributes | |
std::shared_ptr< ITGUIParameter< T > > | fParameter |
Represents an optional parameter (Jmb, Vst or no param at all).
Like GUIVstParam
and GUIJmbParam
, this class is a wrapper arount the underlying parameter. This parameter is used in very generic views that need to handle a Vst or Jmb parameter, as well as no parameter at all (which is for example the case when adding a brand new view in the VSTGUI editor) and still be functional.
You can obtain an instance of an optional parameter by calling any ParamAware::registerOptionalXXX
(resp. ParamAware::registerOptionalDiscreteXX
) method.
GUIOptionalParam
can represent a Vst parameter or a Jmb parameter, there are some restrictions on T
itself (which do not exist if you use GUIJmbParam
):T
must have empty constructor: T()
T
have a copy constructor: T(T const &)
T
must be copy assignable: T& operator=(T const &)
using class_type = GUIOptionalParam<T> |
using EditorType = typename ITGUIParameter<T>::ITEditor |
using ParamType = T |
|
inline |
|
inlineexplicit |
|
inlineexplicit |
|
inline |
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)
).
iChangeListener | the listener that will be notified on parameter changes. nullptr is allowed and will be a noop. |
|
inline |
Creates a connection between this parameter and the callback: whenever the parameter changes, the callback will be invoked (std::function<void()>
).
iChangeCallback | the callback that will be invoked on parameter changes. |
|
inline |
Creates an editor to modify the parameter in a transactional fashion.
|
inline |
Shortcut api which creates an editor followed by ITEditor::setValue(ParamType const &)
to set the parameter value to iValue
.
|
inline |
Always return true
because by definition an optional parameter always exist.
|
inline |
Each parameter has a unique ID returned by this method.
GUIOptionalParam
) may return pongasoft::VST::UNDEFINED_PARAM_ID
|
inline |
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
).
asDiscreteParameter(int32)
may be able to convert/adapt it to one.> 0
if and only if this parameter is a discrete parameter.
|
inline |
T
|
inline |
Allow to use the param as the underlying ParamType
.
Example: if(param)
in the case T
is bool
|
inline |
Allow to write param1 != param2
to compare the underlying values.
|
inline |
Allow to write param = 3
instead of param.update(3)
for example.
|
inline |
Allow to write param1 == param2
to compare the underlying values.
|
inline |
Unconditionaly sets the value of the parameter to the value provided.
iValue | the value to set |
kResultOk
if successful
|
inline |
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.
T
does not provide a way to compare the value, then this call will delegate to setValue(ParamType const &)
and return true
.iValue | the value to update |
true
if the value was updated
|
private |