20 #include <pluginterfaces/vst/vsttypes.h> 21 #include <pongasoft/logging/logging.h> 27 using namespace Steinberg::Vst;
42 using FObject::update;
56 fValue(std::move(iDefaultValue))
69 void setParamID(ParamID iParamID) { fParamID = iParamID; }
83 if constexpr(Utils::is_operator_not_eq_defined<ParamType>)
87 if(setValue(iValue) == kResultOk)
93 if(setValue(iValue) == kResultOk)
102 std::unique_ptr<EditorType>
edit()
override 104 return std::make_unique<DefaultEditorImpl<T>>(
this, getValue());
112 template<
class ValueModifier>
115 if(iValueModifier(&fValue))
140 fValue = std::move(iValue);
169 return std::make_unique<GUIParamCx>(getParamID(), const_cast<GUIValParameter *>(
this), iChangeListener);
177 return std::make_unique<FObjectCxCallback>(const_cast<GUIValParameter *>(
this), iChangeCallback);
181 std::shared_ptr<GUIDiscreteParameter> asDiscreteParameter(int32 iStepCount)
override;
203 fStepCount(iStepCount)
205 DCHECK_F(fStepCount > 0);
223 if constexpr(Utils::is_static_cast_defined<int32, T> && Utils::is_static_cast_defined<T, int32>)
225 return VstUtils::make_sfo<GUIDiscreteValParameter>(fParamID, static_cast<int32>(fValue), iStepCount);
GUIDiscreteValParameter(ParamID iParamID, int32 iDefaultValue, int32 iStepCount)
Definition: GUIValParameter.h:201
~GUIValParameter() override
Definition: GUIValParameter.h:62
GUIValParameter(ParamID iParamID, ParamType const &iDefaultValue)
Definition: GUIValParameter.h:46
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
T fValue
Definition: GUIValParameter.h:185
int32 ParamType
Definition: GUIValParameter.h:39
std::string toUTF8String(T const &iValue, Steinberg::int32 iPrecision)
This generic function will determine (at compilation time) whether T can be written to an ostream and...
Definition: Utils.h:49
GUIValParameter(ParamID iParamID, ParamType &&iDefaultValue)
Definition: GUIValParameter.h:54
std::function< void(T const &)> ValueAccessor
API to access the value of the param.
Definition: IGUIParameter.h:178
std::unique_ptr< FObjectCx > connect(Parameters::ChangeCallback iChangeCallback) const override
Definition: GUIValParameter.h:175
std::shared_ptr< GUIDiscreteParameter > asDiscreteParameter(int32 iStepCount) override
Converts this parameter into a discrete parameter.
Definition: GUIValParameter.h:219
Definition: GUIState.h:36
int32 getStepCount() const override
When a parameter is a discrete parameter (which means its underlying backing type is an int32 with va...
Definition: GUIValParameter.h:71
std::string toUTF8String(int32 iPrecision) const override
Returns the current value of the parameter as a string (which is properly UTF-8 encoded).
Definition: GUIValParameter.h:159
ParamID getParamID() const override
Each parameter has a unique ID returned by this method.
Definition: GUIValParameter.h:68
std::unique_ptr< EditorType > edit() override
Definition: GUIValParameter.h:102
int32 fStepCount
Definition: GUIValParameter.h:212
tresult setValue(ParamType const &iValue) override
Sets the value.
Definition: GUIValParameter.h:127
ParamType const & getValue() const
Definition: GUIValParameter.h:153
typename ITGUIParameter< int32 >::ITEditor EditorType
Definition: GUIValParameter.h:40
bool updateIf(ValueModifier const &iValueModifier)
Use this flavor of update if you want to modify the value itself.
Definition: GUIValParameter.h:113
This parameter is not tied to any parameter definition/registration and is primarily used by the opti...
Definition: GUIValParameter.h:36
std::unique_ptr< FObjectCx > connect(Parameters::IChangeListener *iChangeListener) const override
Definition: GUIValParameter.h:167
Defines the API for the editor which can be obtained by calling ITGUIParameter::edit().
Definition: IGUIParameter.h:232
Simple extension class to treat a Val parameter as a discrete one.
Definition: GUIValParameter.h:198
ParamType & getValue()
Definition: GUIValParameter.h:156
void setParamID(ParamID iParamID)
Definition: GUIValParameter.h:69
tresult setValue(ParamType &&iValue)
Sets the value.
Definition: GUIValParameter.h:138
bool update(ParamType const &iValue) override
Update the parameter with a value.
Definition: GUIValParameter.h:78
ParamID fParamID
Definition: GUIValParameter.h:184
int32 getStepCount() const override
When a parameter is a discrete parameter (which means its underlying backing type is an int32 with va...
Definition: GUIValParameter.h:209
Interface to implement to receive parameter changes.
Definition: Parameters.h:43
tresult accessValue(typename ITGUIParameter< T >::ValueAccessor const &iGetter) const override
Definition: GUIValParameter.h:146