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
addParamID(std::vector<ParamID> &oParamIDs, ParamID iParamID);
472 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs) {
return kResultOk; }
475 template<
typename... Args>
476 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, ParamID
id, Args&& ...args);
479 template<
typename... Args>
480 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<IJmbParamDef> &iParamDef, Args&& ...args)
482 return buildParamIDs(iParamIDs, iParamDef->fParamID, std::forward<Args>(args)...);
486 template<
typename T,
typename... Args>
487 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<JmbParamDef<T>> &iParamDef, Args&& ...args)
489 return buildParamIDs(iParamIDs, iParamDef->fParamID, std::forward<Args>(args)...);
493 template<
typename ParamConverter,
typename... Args>
494 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<VstParamDef<ParamConverter>> &iParamDef, Args&& ...args)
496 return buildParamIDs(iParamIDs, iParamDef->fParamID, std::forward<Args>(args)...);
500 template<
typename ParamConverter,
size_t N,
typename... Args>
501 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, std::array<std::shared_ptr<VstParamDef<ParamConverter>>, N> &iParamDefs, Args&& ...args);
504 template<
typename... Args>
505 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<RawVstParamDef> &iParamDef, Args&& ...args)
507 return buildParamIDs(iParamIDs, iParamDef->fParamID, std::forward<Args>(args)...);
525 return fParameters->add(*
this);
534 return fParameters->add(*
this);
543 auto param = std::make_shared<VstParamDef<T>>(iBuilder.
fParamID,
558 DLOG_F(WARNING,
"No converter defined for non transient parameter [%d]", iBuilder.
fParamID);
573 auto param = std::make_shared<JmbParamDef<T>>(iBuilder.
fParamID,
584 DLOG_F(WARNING,
"No serializer defined for parameter [%d] (won't be able to be saved)", iBuilder.
fParamID);
589 DLOG_F(WARNING,
"No serializer defined for parameter [%d] (won't be able to be shared with peer)", iBuilder.
fParamID);
611 template<
typename ParamConverter,
typename... Args>
614 Args&& ...iConverterArgs)
616 auto builder = vstFromType<typename ParamConverter::ParamType>(iParamID, std::move(iTitle));
617 builder.template converter<ParamConverter>(std::forward<Args>(iConverterArgs)...);
624 template<
typename ParamConverter>
627 typename ParamConverter::ConstructorType initValue) {
628 auto builder = vstFromType<typename ParamConverter::ParamType>(iParamID, std::move(iTitle));
629 builder.template converter<ParamConverter>(initValue);
645 template<
typename ParamSerializer,
typename... Args>
648 Args&& ...iSerializerArgs)
650 auto builder = jmbFromType<typename ParamSerializer::ParamType>(iParamID, std::move(iTitle));
651 builder.template serializer<ParamSerializer>(std::forward<Args>(iSerializerArgs)...);
658 template<
typename ParamSerializer>
661 typename ParamSerializer::ConstructorType initValue) {
662 auto builder = jmbFromType<typename ParamSerializer::ParamType>(iParamID, std::move(iTitle));
663 builder.template serializer<ParamSerializer>(initValue);
670 template<
typename... Args>
673 tresult res =
addParamID(iParamIDs, iParamID);
674 res |=
buildParamIDs(iParamIDs, std::forward<Args>(args)...);
681 template<
typename ParamConverter,
size_t N,
typename... Args>
682 tresult
Parameters::buildParamIDs(std::vector<ParamID> &iParamIDs, std::array<std::shared_ptr<VstParamDef<ParamConverter>>, N> &iParamDefs, Args&& ...args)
684 tresult res = kResultOk;
685 for(
auto &def: iParamDefs)
687 res |=
buildParamIDs(iParamIDs, std::forward<Args>(args)...);
694 template<
typename... Args>
697 std::vector<ParamID> ids{};
705 template<
typename... Args>
708 std::vector<ParamID> ids{};
716 template<
typename... Args>
719 std::vector<ParamID> ids{};
727 template<
typename... Args>
730 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:717
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
tresult buildParamIDs(std::vector< ParamID > &iParamIDs, std::shared_ptr< VstParamDef< ParamConverter >> &iParamDef, Args &&...args)
Definition: Parameters.h:494
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:695
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:509
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:472
RawVstParamDefBuilder & deprecatedSince(int16 iVersion)
Definition: Parameters.h:85
std::map< int16, NormalizedState::SaveOrder > fGUIDeprecatedSaveStateOrders
Definition: Parameters.h:465
tresult addParamID(std::vector< ParamID > &oParamIDs, ParamID iParamID)
Definition: Parameters.cpp:625
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:505
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:646
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:487
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:107
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:637
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:612
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:706
VstParamDefBuilder< T > vstFromType(ParamID iParamID, VstString16 iTitle)
Used from derived classes to build a parameter backed by a VST parameter.
Definition: Parameters.h:603
JmbParamDefBuilder & deprecatedSince(int16 iVersion)
Definition: Parameters.h:171
VstParam< T > add() const
Definition: Parameters.h:532
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:480
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:523
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:728
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