28 #include <public.sdk/source/vst/vstparameters.h> 32 namespace Debug {
class ParamDisplay; }
60 template<
typename Param>
66 template<
typename TView,
typename Param>
96 int32
fFlags{ParameterInfo::kCanAutomate};
100 IParamDef::Owner
fOwner{IParamDef::Owner::kRT};
132 template<
typename ParamConverter,
typename... Args>
136 VstParam<T>
add()
const;
143 int32
fFlags{ParameterInfo::kCanAutomate};
147 IParamDef::Owner
fOwner{IParamDef::Owner::kRT};
176 template<
typename ParamSerializer,
typename... Args>
180 JmbParam<T>
add()
const;
186 IParamDef::Owner
fOwner{IParamDef::Owner::kGUI};
218 template<
typename ParamConverter,
typename... Args>
224 template<
typename ParamConverter>
227 typename ParamConverter::ConstructorType initValue);
239 template<
typename ParamSerializer,
typename... Args>
245 template<
typename ParamSerializer>
248 typename ParamSerializer::ConstructorType initValue);
264 template<
typename... Args>
286 template<
typename... Args>
301 template<
typename... Args>
323 template<
typename... Args>
355 virtual std::unique_ptr<NormalizedState>
newRTState()
const;
371 std::shared_ptr<IJmbParamDef>
getJmbParamDef(ParamID iParamID)
const;
437 tresult
addVstParamDef(std::shared_ptr<RawVstParamDef> iParamDef);
448 std::map<ParamID, std::shared_ptr<RawVstParamDef>>
fVstParams{};
451 std::map<ParamID, std::shared_ptr<IJmbParamDef>>
fJmbParams{};
469 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs) {
return kResultOk; }
472 template<
typename... Args>
473 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, ParamID
id, Args&& ...args);
476 template<
typename... Args>
477 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<IJmbParamDef> &iParamDef, Args&& ...args)
479 return buildParamIDs(iParamIDs, iParamDef->fParamID, std::forward<Args>(args)...);
483 template<
typename T,
typename... Args>
484 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<JmbParamDef<T>> &iParamDef, Args&& ...args)
486 return buildParamIDs(iParamIDs, iParamDef->fParamID, std::forward<Args>(args)...);
490 template<
typename ParamConverver,
typename... Args>
491 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<VstParamDef<ParamConverver>> &iParamDef, Args&& ...args)
493 return buildParamIDs(iParamIDs, iParamDef->fParamID, std::forward<Args>(args)...);
497 template<
typename... Args>
498 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<RawVstParamDef> &iParamDef, Args&& ...args)
500 return buildParamIDs(iParamIDs, iParamDef->fParamID, std::forward<Args>(args)...);
518 return fParameters->add(*
this);
527 return fParameters->add(*
this);
536 auto param = std::make_shared<VstParamDef<T>>(iBuilder.
fParamID,
551 DLOG_F(WARNING,
"No converter defined for non transient parameter [%d]", iBuilder.
fParamID);
566 auto param = std::make_shared<JmbParamDef<T>>(iBuilder.
fParamID,
577 DLOG_F(WARNING,
"No serializer defined for parameter [%d] (won't be able to be saved)", iBuilder.
fParamID);
582 DLOG_F(WARNING,
"No serializer defined for parameter [%d] (won't be able to be shared with peer)", iBuilder.
fParamID);
604 template<
typename ParamConverter,
typename... Args>
607 Args&& ...iConverterArgs)
609 auto builder = vstFromType<typename ParamConverter::ParamType>(iParamID, std::move(iTitle));
610 builder.template converter<ParamConverter>(std::forward<Args>(iConverterArgs)...);
617 template<
typename ParamConverter>
620 typename ParamConverter::ConstructorType initValue) {
621 auto builder = vstFromType<typename ParamConverter::ParamType>(iParamID, std::move(iTitle));
622 builder.template converter<ParamConverter>(initValue);
638 template<
typename ParamSerializer,
typename... Args>
641 Args&& ...iSerializerArgs)
643 auto builder = jmbFromType<typename ParamSerializer::ParamType>(iParamID, std::move(iTitle));
644 builder.template serializer<ParamSerializer>(std::forward<Args>(iSerializerArgs)...);
651 template<
typename ParamSerializer>
654 typename ParamSerializer::ConstructorType initValue) {
655 auto builder = jmbFromType<typename ParamSerializer::ParamType>(iParamID, std::move(iTitle));
656 builder.template serializer<ParamSerializer>(initValue);
663 template<
typename... Args>
666 tresult res = kResultOk;
671 iParamIDs.emplace_back(iParamID);
675 DLOG_F(ERROR,
"No such parameter [%d]", iParamID);
678 res |=
buildParamIDs(iParamIDs, std::forward<Args>(args)...);
685 template<
typename... Args>
688 std::vector<ParamID> ids{};
696 template<
typename... Args>
699 std::vector<ParamID> ids{};
707 template<
typename... Args>
710 std::vector<ParamID> ids{};
718 template<
typename... Args>
721 std::vector<ParamID> ids{};
VstParamDefBuilder & converter(std::shared_ptr< IParamConverter< T >> iConverter)
Definition: Parameters.h:131
std::shared_ptr< IParamConverter< T > > fConverter
Definition: Parameters.h:150
std::vector< ParamID > const & getAllRegistrationOrder() const
Definition: Parameters.h:377
std::shared_ptr< IParamSerializer< T > > fSerializer
Definition: Parameters.h:190
VstString16 fShortTitle
Definition: Parameters.h:145
VstString16 fShortTitle
Definition: Parameters.h:98
This is the class which maintains all the registered parameters.
Definition: Parameters.h:37
virtual ~Parameters()=default
VstString16 fUnits
Definition: Parameters.h:141
VstString16 fTitle
Definition: Parameters.h:140
int32 fFlags
Definition: Parameters.h:143
VstString16 fTitle
Definition: Parameters.h:92
NormalizedState::SaveOrder const & getRTSaveStateOrder() const
Definition: Parameters.h:336
std::function< void(TView *, Param &)> ChangeCallback2
A callback which will be invoked for changes with the view and param as arguments.
Definition: Parameters.h:67
tresult setGUISaveStateOrder(int16 iVersion, Args &&...args)
Used to change the default order (registration order) used when saving the GUI state (getState/setSta...
Definition: Parameters.h:708
Implements the builder pattern for ease of build.
Definition: Parameters.h:72
This helper class is used to display the parameters (vst/jmb) WARNING: this class is allocating memor...
Definition: ParamDisplay.h:33
std::shared_ptr< IJmbParamDef > getJmbParamDef(ParamID iParamID) const
Definition: Parameters.cpp:185
Implements the builder pattern for ease of build.
Definition: Parameters.h:166
std::function< void()> ChangeCallback
A callback that will be invoked for changes.
Definition: Parameters.h:55
RawVstParamDefBuilder & unitID(int32 iUnitID)
Definition: Parameters.h:79
tresult setRTSaveStateOrder(int16 iVersion, Args &&...args)
Used to change the default order (registration order) used when saving the RT state (getState/setStat...
Definition: Parameters.h:686
virtual tresult readDeprecatedRTState(uint16 iVersion, IBStreamer &iStreamer, NormalizedState *oNormalizedState) const
This method is called to read a deprecated (prior version) RTState from the stream.
Definition: Parameters.cpp:112
Maintains the order used to save/restore the RT and GUI state.
Definition: NormalizedState.h:43
std::map< int16, NormalizedState::SaveOrder > fRTDeprecatedSaveStateOrders
Definition: Parameters.h:464
std::shared_ptr< RawVstParamDef > RawVstParam
Definition: ParamDef.h:508
ParamID fParamID
Definition: Parameters.h:183
virtual ParamValue readNormalizedValue(ParamID iParamID, IBStreamer &iStreamer) const
Definition: Parameters.cpp:158
VstParamDefBuilder & converter(Args &&...iArgs)
Definition: Parameters.h:133
RawVstParamDefBuilder & shortTitle(VstString16 iShortTitle)
Definition: Parameters.h:80
bool fTransient
Definition: Parameters.h:148
VstParamDefBuilder & precision(int32 iPrecision)
Definition: Parameters.h:126
int32 fPrecision
Definition: Parameters.h:99
virtual tresult readRTState(IBStreamer &iStreamer, NormalizedState *oNormalizedState) const
This method is called to read the RTState from the stream.
Definition: Parameters.cpp:94
ParamValue fDefaultValue
Definition: Parameters.h:94
int32 fFlags
Definition: Parameters.h:96
VstParamDefBuilder & unitID(int32 iUnitID)
Definition: Parameters.h:124
VstParamDefBuilder & deprecatedSince(int16 iVersion)
Definition: Parameters.h:130
std::vector< ParamID > fVstRegistrationOrder
Definition: Parameters.h:454
void registerVstParameters(Vst::ParameterContainer &iParameterContainer) const
This method is called from the GUI controller to register all the parameters to the ParameterContaine...
Definition: Parameters.cpp:55
NormalizedState::SaveOrder fRTSaveStateOrder
Definition: Parameters.h:460
RawVstParam add(RawVstParamDefBuilder const &iBuilder)
Definition: Parameters.cpp:593
Used to communicate the state between the UI and the RT and read/write to stream.
Definition: NormalizedState.h:37
NormalizedState::SaveOrder fGUISaveStateOrder
Definition: Parameters.h:461
Parameters * fParameters
Definition: Parameters.h:159
std::shared_ptr< RawVstParamDef > getRawVstParamDef(ParamID iParamID) const
Definition: Parameters.cpp:173
std::vector< ParamID > fAllRegistrationOrder
Definition: Parameters.h:457
UnitID fUnitID
Definition: Parameters.h:97
VstParamDefBuilder & flags(int32 iFlags)
Definition: Parameters.h:123
int32 fPrecision
Definition: Parameters.h:146
tresult buildParamIDs(std::vector< ParamID > &iParamIDs)
Definition: Parameters.h:469
RawVstParamDefBuilder & deprecatedSince(int16 iVersion)
Definition: Parameters.h:85
std::map< int16, NormalizedState::SaveOrder > fGUIDeprecatedSaveStateOrders
Definition: Parameters.h:465
Parameters * fParameters
Definition: Parameters.h:199
virtual std::unique_ptr< NormalizedState > newRTState() const
Definition: Parameters.cpp:67
std::basic_string< Steinberg::char16 > VstString16
Strings made of char16 characters are represented by the native C++11 type std::basic_string<Steinber...
Definition: Types.h:43
JmbParamDefBuilder & serializer(Args &&...iArgs)
Definition: Parameters.h:177
VstString16 fUnits
Definition: Parameters.h:93
tresult buildParamIDs(std::vector< ParamID > &iParamIDs, std::shared_ptr< RawVstParamDef > &iParamDef, Args &&...args)
Definition: Parameters.h:498
std::vector< ParamID > const & getVstRegistrationOrder() const
Definition: Parameters.h:374
JmbParamDefBuilder< typename ParamSerializer::ParamType > jmb(ParamID iParamID, VstString16 iTitle, Args &&...iSerializerArgs)
Used from derived classes to build a non vst parameter (not convertible to a ParamValue)
Definition: Parameters.h:639
RawVstParamDefBuilder & units(VstString16 iUnits)
Definition: Parameters.h:75
RawVstParamDefBuilder & rtOwned()
Definition: Parameters.h:82
int32 fStepCount
Definition: Parameters.h:95
NormalizedState::SaveOrder const * getGUIDeprecatedSaveStateOrder(int16 iVersion) const
Definition: Parameters.cpp:572
RawVstParamDefBuilder(Parameters *iParameters, ParamID iParamID, VstString16 iTitle)
Definition: Parameters.h:107
Parameters * fParameters
Definition: Parameters.h:111
UnitID fUnitID
Definition: Parameters.h:144
RawVstParamDefBuilder & precision(int32 iPrecision)
Definition: Parameters.h:81
RawVstParamDefBuilder & flags(int32 iFlags)
Definition: Parameters.h:78
tresult buildParamIDs(std::vector< ParamID > &iParamIDs, std::shared_ptr< JmbParamDef< T >> &iParamDef, Args &&...args)
Definition: Parameters.h:484
JmbParamDefBuilder & defaultValue(T const &iDefaultValue)
Definition: Parameters.h:169
A vst parameter is represented by a ParamValue type which is a double in the range [0,...
Definition: ParamSerializers.h:105
JmbParamDefBuilder< T > jmbFromType(ParamID iParamID, VstString16 iTitle)
Used from derived classes to build a non vst parameter (not convertible to a ParamValue).
Definition: Parameters.h:630
std::function< void(Param &)> ChangeCallback1
A callback which will be invoked for changes with the param as an argument.
Definition: Parameters.h:61
VstParamDefBuilder & rtOwned()
Definition: Parameters.h:127
VstString16 fTitle
Definition: Parameters.h:184
virtual void onParameterChange(ParamID iParamID)=0
NormalizedState::SaveOrder const & getGUISaveStateOrder() const
Definition: Parameters.h:292
bool fTransient
Definition: Parameters.h:101
JmbParamDefBuilder & rtOwned()
Definition: Parameters.h:172
RawVstParam add() const
Definition: Parameters.cpp:585
VstParamDefBuilder< typename ParamConverter::ParamType > vst(ParamID iParamID, VstString16 iTitle, Args &&...iConverterArgs)
Used from derived classes to build a parameter backed by a VST parameter.
Definition: Parameters.h:605
RawVstParamDefBuilder & defaultValue(ParamValue iDefaultValue)
Definition: Parameters.h:76
tresult setRTDeprecatedSaveStateOrder(int16 iVersion, Args &&...args)
This method should be called to save the order of a deprecated version so that it can be handled duri...
Definition: Parameters.h:697
VstParamDefBuilder< T > vstFromType(ParamID iParamID, VstString16 iTitle)
Used from derived classes to build a parameter backed by a VST parameter.
Definition: Parameters.h:596
JmbParamDefBuilder & deprecatedSince(int16 iVersion)
Definition: Parameters.h:171
VstParam< T > add() const
Definition: Parameters.h:525
tresult addVstParamDef(std::shared_ptr< RawVstParamDef > iParamDef)
Definition: Parameters.cpp:198
JmbParamDefBuilder & serializer(std::shared_ptr< IParamSerializer< T >> iSerializer)
Definition: Parameters.h:175
RawVstParamDefBuilder & stepCount(int32 iStepCount)
Definition: Parameters.h:77
int16 fDeprecatedSince
Definition: Parameters.h:102
JmbParamDefBuilder & shared(bool iShared=true)
Definition: Parameters.h:174
int16 fDeprecatedSince
Definition: Parameters.h:149
tresult buildParamIDs(std::vector< ParamID > &iParamIDs, std::shared_ptr< IJmbParamDef > &iParamDef, Args &&...args)
Definition: Parameters.h:477
VstParamDefBuilder & defaultValue(T const &iDefaultValue)
Definition: Parameters.h:122
T fDefaultValue
Definition: Parameters.h:185
ParamID fParamID
Definition: Parameters.h:91
RawVstParamDefBuilder raw(ParamID iParamID, VstString16 iTitle)
Used from derived classes to build a parameter backed by a raw VST parameter.
Definition: Parameters.cpp:617
JmbParamDefBuilder & guiOwned()
Definition: Parameters.h:173
virtual tresult handleRTStateUpgrade(NormalizedState const &iDeprecatedState, NormalizedState &oNewState) const
When Jamba detects that a previously saved RT state matches a deprecated version (as registered with ...
Definition: Parameters.h:416
virtual tresult writeRTState(NormalizedState const *iNormalizedState, IBStreamer &oStreamer) const
This method is called to write the NormalizedState to the stream.
Definition: Parameters.cpp:149
IParamDef::Owner fOwner
Definition: Parameters.h:186
JmbParam< T > add() const
Definition: Parameters.h:516
ParamID fParamID
Definition: Parameters.h:139
tresult setGUIDeprecatedSaveStateOrder(int16 iVersion, Args &&...args)
This method should be called to save the order of a deprecated version so that it can be handled duri...
Definition: Parameters.h:719
tresult buildParamIDs(std::vector< ParamID > &iParamIDs, std::shared_ptr< VstParamDef< ParamConverver >> &iParamDef, Args &&...args)
Definition: Parameters.h:491
RawVstParamDefBuilder & guiOwned()
Definition: Parameters.h:83
VstParamDefBuilder & units(VstString16 iUnits)
Definition: Parameters.h:121
IParamDef::Owner fOwner
Definition: Parameters.h:100
bool fTransient
Definition: Parameters.h:187
tresult addJmbParamDef(std::shared_ptr< IJmbParamDef > iParamDef)
Definition: Parameters.cpp:236
JmbParamDefBuilder(Parameters *iParameters, ParamID iParamID, VstString16 iTitle)
Definition: Parameters.h:195
VstParamDefBuilder(Parameters *iParameters, ParamID iParamID, VstString16 iTitle)
Definition: Parameters.h:155
VstParamDefBuilder & shortTitle(VstString16 iShortTitle)
Definition: Parameters.h:125
T fDefaultValue
Definition: Parameters.h:142
IParamDef::Owner fOwner
Definition: Parameters.h:147
Implements the builder pattern for ease of build.
Definition: Parameters.h:118
std::map< ParamID, std::shared_ptr< IJmbParamDef > > fJmbParams
Definition: Parameters.h:451
Interface to implement to receive parameter changes.
Definition: Parameters.h:43
bool fShared
Definition: Parameters.h:189
A vst parameter is represented by a ParamValue type which is a double in the range [0,...
Definition: ParamConverters.h:53
int16 fDeprecatedSince
Definition: Parameters.h:188
std::map< ParamID, std::shared_ptr< RawVstParamDef > > fVstParams
Definition: Parameters.h:448
VstParamDefBuilder & guiOwned()
Definition: Parameters.h:128