96 using EditorType::commit;
168 auto newNormalizedValued =
fConverter->normalize(iValue);
169 if(currentNormalizedValue != newNormalizedValued)
232 std::unique_ptr<EditorType>
edit()
override
284 using Editor = std::unique_ptr<EditorType>;
303 fPtr{std::move(iPtr)}
401 [[deprecated(
"Since 4.1.0 - use operator* or .value() instead (ex: if(*param) {...} or if(param.value()) {...}")]]
402 inline operator T()
const { DCHECK_F(
exists());
return fPtr->getValue(); }
421 std::shared_ptr<GUIVstParameter<T>>
fPtr;
431 auto vstParamDef = std::dynamic_pointer_cast<VstParamDef<T>>(
fParamDef);
432 if(vstParamDef && vstParamDef->fConverter)
433 return std::make_shared<GUIVstParameter<T>>(std::dynamic_pointer_cast<GUIRawVstParameter>(shared_from_this()),
434 vstParamDef->fConverter);
Implements all the various equality and relational operators for the type T which is assumed to encap...
Definition Operators.h:56
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition GUIRawVstParameter.h:267
ParamValue getValue() const
Definition GUIRawVstParameter.h:291
std::shared_ptr< RawVstParamDef > fParamDef
Definition GUIRawVstParameter.h:256
std::shared_ptr< GUIVstParameter< T > > asVstParameter()
Converts to a typed parameter.
Definition GUIVstParameter.h:429
constexpr T const * operator->() const
Definition GUIVstParameter.h:293
Value(T const &iValue)
Definition GUIVstParameter.h:296
T fValue
Definition GUIVstParameter.h:297
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition GUIVstParameter.h:280
bool update(T const &iValue)
Update the parameter with a value.
Definition GUIVstParameter.h:333
tresult copyValueFrom(GUIVstParam< V > const &iParam)
Shortcut to copy the value from another param to this one.
Definition GUIVstParameter.h:356
tresult setValue(T const &iValue)
Sets the value of this parameter.
Definition GUIVstParameter.h:339
typename GUIVstParameter< T >::ITEditor EditorType
Definition GUIVstParameter.h:283
int32 getStepCount() const
Definition GUIVstParameter.h:366
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:380
Editor edit(T const &iValue)
Shortcut to create an editor and set the value to it.
Definition GUIVstParameter.h:392
T getValue() const
Definition GUIVstParameter.h:318
constexpr T operator*() const
allow writing *param to access the underlying value (or in other words, *param is the same param....
Definition GUIVstParameter.h:395
void toString(String128 oString)
Populates the oString with a string representation of this parameter.
Definition GUIVstParameter.h:371
ParamID getParamID() const
Definition GUIVstParameter.h:313
std::unique_ptr< FObjectCx > connect(Parameters::ChangeCallback iChangeCallback) const
Definition GUIVstParameter.h:418
GUIVstParam< T > & operator=(T const &iValue)
Allow to write param = 3.0.
Definition GUIVstParameter.h:405
bool exists() const
Definition GUIVstParameter.h:310
std::unique_ptr< FObjectCx > connect(Parameters::IChangeListener *iChangeListener) const
Allow to write param1 == param2.
Definition GUIVstParameter.h:413
tresult copyValueFrom(GUIRawVstParam const &iParam)
Shortcut to copy the value from another param to this one (raw value).
Definition GUIVstParameter.h:361
ParamValue getNormalizedValue() const
Definition GUIVstParameter.h:326
T value() const
Synonym to getValue().
Definition GUIVstParameter.h:321
tresult setNormalizedValue(ParamValue const &iNormalizedValue)
Sets the value of this parameter as a normalized value.
Definition GUIVstParameter.h:345
T ParamType
Definition GUIVstParameter.h:282
constexpr Value operator->() const
allow writing param->x to access the underlying value when T is a struct or class
Definition GUIVstParameter.h:398
tresult resetToDefault()
Resets the param to its default value.
Definition GUIVstParameter.h:349
std::unique_ptr< EditorType > Editor
Definition GUIVstParameter.h:284
GUIVstParam(std::shared_ptr< GUIVstParameter< T > > iPtr=nullptr)
Definition GUIVstParameter.h:302
GUIVstParam< T > & operator=(GUIVstParam< T > const &iOther)=default
Assignment operator: fMyParam = registerParam(...);.
Editor edit()
Definition GUIVstParameter.h:385
std::shared_ptr< GUIVstParameter< bool > > fPtr
Definition GUIVstParameter.h:421
Steinberg::String toString()
Returns a string representation of this parameter.
Definition GUIVstParameter.h:376
tresult commit() override
Definition GUIVstParameter.h:90
bool updateValue(ParamType const &iValue) override
Change the value of the parameter.
Definition GUIVstParameter.h:81
Editor & operator=(Editor const &)=delete
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:102
GUIRawVstParamEditor fRawEditor
Definition GUIVstParameter.h:108
tresult setValue(ParamType const &iValue) override
Change the value of the parameter.
Definition GUIVstParameter.h:72
~Editor() override
Definition GUIVstParameter.h:63
Editor(GUIRawVstParamEditor iRawEditor, std::shared_ptr< IParamConverter< T > > iConverter)
Definition GUIVstParameter.h:56
std::shared_ptr< IParamConverter< T > > fConverter
Definition GUIVstParameter.h:109
Editor(Editor const &)=delete
This class wraps a GUIRawVstParameter to deal with any type T.
Definition GUIVstParameter.h:34
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:224
int32 getStepCount() const override
Definition GUIVstParameter.h:205
std::shared_ptr< GUIRawVstParameter > fRawParameter
Definition GUIVstParameter.h:265
ParamID getParamID() const override
Each parameter has a unique ID returned by this method.
Definition GUIVstParameter.h:131
std::shared_ptr< GUIDiscreteParameter > asDiscreteParameter(int32 iStepCount) override
Converts this parameter into a discrete parameter.
Definition GUIVstParameter.h:259
tresult resetToDefault() override
Resets the parameter to its default value.
Definition GUIVstParameter.h:197
~GUIVstParameter()
Definition GUIVstParameter.h:125
tresult setValue(ParamType const &iValue) override
Sets the value of this parameter.
Definition GUIVstParameter.h:181
void toString(String128 oString)
Populates the oString with a string representation of this parameter.
Definition GUIVstParameter.h:210
std::unique_ptr< EditorType > edit() override
Definition GUIVstParameter.h:232
std::unique_ptr< FObjectCx > connect(Parameters::ChangeCallback iChangeCallback) const override
Definition GUIVstParameter.h:253
GUIVstParameter(std::shared_ptr< GUIRawVstParameter > iRawParameter, std::shared_ptr< IParamConverter< T > > iConverter)
Definition GUIVstParameter.h:114
ParamType getValue() const
Definition GUIVstParameter.h:146
bool update(ParamType const &iValue) override
Update the parameter with a value.
Definition GUIVstParameter.h:164
std::unique_ptr< FObjectCx > connect(Parameters::IChangeListener *iChangeListener) const override
Definition GUIVstParameter.h:245
ParamValue getNormalizedValue() const
Definition GUIVstParameter.h:154
tresult setNormalizedValue(ParamValue const &iNormalizedValue)
Sets the value of this parameter as a normalized value.
Definition GUIVstParameter.h:190
T ParamType
Definition GUIVstParameter.h:36
typename ITGUIParameter< T >::ITEditor EditorType
Definition GUIVstParameter.h:37
tresult accessValue(typename ITGUIParameter< T >::ValueAccessor const &iGetter) const override
Definition GUIVstParameter.h:137
std::shared_ptr< IParamConverter< T > > fConverter
Definition GUIVstParameter.h:266
Steinberg::String toString()
Returns a string representation of this parameter.
Definition GUIVstParameter.h:218
Defines the API for the editor which can be obtained by calling ITGUIParameter::edit().
Definition IGUIParameter.h:238
Represents a gui parameter with its underlying backing type T (aka ParamType).
Definition IGUIParameter.h:172
std::function< void(T const &)> ValueAccessor
API to access the value of the param.
Definition IGUIParameter.h:183
A vst parameter is represented by a ParamValue type which is a double in the range [0,...
Definition ParamConverters.h:55
Interface to implement to receive parameter changes.
Definition Parameters.h:45
std::function< void()> ChangeCallback
A callback that will be invoked for changes.
Definition Parameters.h:56
GUIVstParam< bool > GUIVstBooleanParam
Definition GUIVstParameter.h:445
std::unique_ptr< typename GUIVstParameter< T >::EditorType > GUIVstParamEditor
Definition GUIVstParameter.h:443
GUIVstParam< Percent > GUIVstPercentParam
Definition GUIVstParameter.h:446
std::unique_ptr< GUIRawVstParameter::EditorType > GUIRawVstParamEditor
Definition GUIRawVstParameter.h:376