32 class GUIVstParameter :
public ITGUIParameter<T>
95 using EditorType::commit;
167 auto newNormalizedValued =
fConverter->normalize(iValue);
168 if(currentNormalizedValue != newNormalizedValued)
231 std::unique_ptr<EditorType>
edit()
override 283 using Editor = std::unique_ptr<EditorType>;
302 fPtr{std::move(iPtr)}
400 [[deprecated(
"Since 4.1.0 - use operator* or .value() instead (ex: if(*param) {...} or if(param.value()) {...}")]]
401 inline operator T()
const { DCHECK_F(
exists());
return fPtr->getValue(); }
420 std::shared_ptr<GUIVstParameter<T>>
fPtr;
431 if(vstParamDef && vstParamDef->fConverter)
432 return std::make_shared<GUIVstParameter<T>>(std::dynamic_pointer_cast<GUIRawVstParameter>(shared_from_this()),
433 vstParamDef->fConverter);
typename ITGUIParameter< T >::ITEditor EditorType
Definition: GUIVstParameter.h:36
T getValue() const
Definition: GUIVstParameter.h:317
T value() const
Synonym to getValue()
Definition: GUIVstParameter.h:320
tresult rollback() override
Call this if you want to revert to the original value of the parameter (when the editor is created).
Definition: GUIVstParameter.h:101
tresult setValue(ParamType const &iValue) override
Sets the value of this parameter.
Definition: GUIVstParameter.h:180
ParamType getValue() const
Definition: GUIVstParameter.h:145
T ParamType
Definition: GUIVstParameter.h:281
bool update(ParamType const &iValue) override
Update the parameter with a value.
Definition: GUIVstParameter.h:163
int32 getStepCount() const
Definition: GUIVstParameter.h:365
std::shared_ptr< IParamConverter< T > > fConverter
Definition: GUIVstParameter.h:265
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition: GUIRawVstParameter.h:265
ParamValue getNormalizedValue() const
Definition: GUIVstParameter.h:153
std::function< void()> ChangeCallback
A callback that will be invoked for changes.
Definition: Parameters.h:55
Represents a gui parameter with its underlying backing type T (aka ParamType).
Definition: IGUIParameter.h:33
tresult setNormalizedValue(ParamValue const &iNormalizedValue)
Sets the value of this parameter as a normalized value.
Definition: GUIVstParameter.h:344
Editor edit(T const &iValue)
Shortcut to create an editor and set the value to it.
Definition: GUIVstParameter.h:391
~Editor() override
Definition: GUIVstParameter.h:62
bool exists() const
Definition: GUIVstParameter.h:309
std::unique_ptr< EditorType > edit() override
Definition: GUIVstParameter.h:231
Value(T const &iValue)
Definition: GUIVstParameter.h:295
void toString(String128 oString)
Populates the oString with a string representation of this parameter.
Definition: GUIVstParameter.h:370
std::shared_ptr< GUIVstParameter< T > > fPtr
Definition: GUIVstParameter.h:420
GUIVstParam< T > & operator=(T const &iValue)
Allow to write param = 3.0.
Definition: GUIVstParameter.h:404
tresult copyValueFrom(GUIVstParam< V > const &iParam)
Shortcut to copy the value from another param to this one.
Definition: GUIVstParameter.h:355
std::shared_ptr< RawVstParamDef > fParamDef
Definition: GUIRawVstParameter.h:255
Implements all the various equality and relational operators for the type T which is assumed to encap...
Definition: Operators.h:54
std::function< void(T const &)> ValueAccessor
API to access the value of the param.
Definition: IGUIParameter.h:182
tresult setValue(T const &iValue)
Sets the value of this parameter.
Definition: GUIVstParameter.h:338
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition: GUIVstParameter.h:278
bool update(T const &iValue)
Update the parameter with a value.
Definition: GUIVstParameter.h:332
std::unique_ptr< typename GUIVstParameter< T >::EditorType > GUIVstParamEditor
Definition: GUIVstParameter.h:442
std::unique_ptr< FObjectCx > connect(Parameters::IChangeListener *iChangeListener) const
Allow to write param1 == param2.
Definition: GUIVstParameter.h:412
std::shared_ptr< GUIDiscreteParameter > asDiscreteParameter(int32 iStepCount) override
Converts this parameter into a discrete parameter.
Definition: GUIVstParameter.h:258
Definition: GUIState.h:37
tresult setValue(ParamType const &iValue) override
Change the value of the parameter.
Definition: GUIVstParameter.h:71
bool updateValue(ParamType const &iValue) override
Change the value of the parameter.
Definition: GUIVstParameter.h:80
~GUIVstParameter()
Definition: GUIVstParameter.h:124
void toString(String128 oString)
Populates the oString with a string representation of this parameter.
Definition: GUIVstParameter.h:209
tresult resetToDefault() override
Resets the parameter to its default value.
Definition: GUIVstParameter.h:196
The purpose of this class is to copy the value so that it can be accessed via -> thus allowing to wri...
Definition: GUIVstParameter.h:290
GUIVstParam(std::shared_ptr< GUIVstParameter< T >> iPtr=nullptr)
Definition: GUIVstParameter.h:301
Editor & operator=(Editor const &)=delete
Editor(GUIRawVstParamEditor iRawEditor, std::shared_ptr< IParamConverter< T >> iConverter)
Definition: GUIVstParameter.h:55
Steinberg::String toString()
Returns a string representation of this parameter.
Definition: GUIVstParameter.h:375
GUIRawVstParamEditor fRawEditor
Definition: GUIVstParameter.h:107
std::shared_ptr< GUIRawVstParameter > fRawParameter
Definition: GUIVstParameter.h:264
std::unique_ptr< FObjectCx > connect(Parameters::IChangeListener *iChangeListener) const override
Definition: GUIVstParameter.h:244
ParamValue getValue() const
Definition: GUIRawVstParameter.h:290
tresult accessValue(typename ITGUIParameter< T >::ValueAccessor const &iGetter) const override
Definition: GUIVstParameter.h:136
std::unique_ptr< FObjectCx > connect(Parameters::ChangeCallback iChangeCallback) const override
Definition: GUIVstParameter.h:252
Editor edit()
Definition: GUIVstParameter.h:384
std::string toUTF8String(int32 iPrecision) const
Returns the current value of the parameter as a string (which is properly UTF-8 encoded).
Definition: GUIVstParameter.h:379
constexpr Value operator ->() const
allow writing param->x to access the underlying value when T is a struct or class
Definition: GUIVstParameter.h:397
std::unique_ptr< EditorType > Editor
Definition: GUIVstParameter.h:283
This class wraps a GUIRawVstParameter to deal with any type T.
Definition: GUIRawVstParameter.h:31
std::string toUTF8String(int32 iPrecision) const override
Returns the current value of the parameter as a string (which is properly UTF-8 encoded).
Definition: GUIVstParameter.h:223
tresult setNormalizedValue(ParamValue const &iNormalizedValue)
Sets the value of this parameter as a normalized value.
Definition: GUIVstParameter.h:189
typename GUIVstParameter< T >::ITEditor EditorType
Definition: GUIVstParameter.h:282
GUIVstParameter(std::shared_ptr< GUIRawVstParameter > iRawParameter, std::shared_ptr< IParamConverter< T >> iConverter)
Definition: GUIVstParameter.h:113
std::unique_ptr< GUIRawVstParameter::EditorType > GUIRawVstParamEditor
Definition: GUIRawVstParameter.h:375
GUIVstParam< T > & operator=(GUIVstParam< T > const &iOther)=default
Assignment operator: fMyParam = registerParam(...);
ParamID getParamID() const
Definition: GUIVstParameter.h:312
Typed parameter definition.
Definition: ParamDef.h:176
tresult copyValueFrom(GUIRawVstParam const &iParam)
Shortcut to copy the value from another param to this one (raw value)
Definition: GUIVstParameter.h:360
T ParamType
Definition: GUIVstParameter.h:35
tresult resetToDefault()
Resets the param to its default value.
Definition: GUIVstParameter.h:348
Defines the API for the editor which can be obtained by calling ITGUIParameter::edit().
Definition: IGUIParameter.h:236
ParamValue getNormalizedValue() const
Definition: GUIVstParameter.h:325
Wrapper to edit a single parameter.
Definition: GUIVstParameter.h:52
constexpr T const * operator ->() const
Definition: GUIVstParameter.h:292
std::shared_ptr< GUIVstParameter< T > > asVstParameter()
Converts to a typed parameter.
Definition: GUIVstParameter.h:428
T fValue
Definition: GUIVstParameter.h:296
tresult commit() override
Definition: GUIVstParameter.h:89
std::shared_ptr< IParamConverter< T > > fConverter
Definition: GUIVstParameter.h:108
int32 getStepCount() const override
Definition: GUIVstParameter.h:204
ParamID getParamID() const override
Each parameter has a unique ID returned by this method.
Definition: GUIVstParameter.h:130
constexpr T operator *() const
allow writing *param to access the underlying value (or in other words, *param is the same param....
Definition: GUIVstParameter.h:394
std::unique_ptr< FObjectCx > connect(Parameters::ChangeCallback iChangeCallback) const
Definition: GUIVstParameter.h:417
Steinberg::String toString()
Returns a string representation of this parameter.
Definition: GUIVstParameter.h:217
Interface to implement to receive parameter changes.
Definition: Parameters.h:43
A vst parameter is represented by a ParamValue type which is a double in the range [0,...
Definition: ParamConverters.h:53