18 #ifndef __PONGASOFT_VST_PARAMETERS_H__ 19 #define __PONGASOFT_VST_PARAMETERS_H__ 29 #include <public.sdk/source/vst/vstparameters.h> 34 namespace Debug {
class ParamDisplay; }
62 template<
typename Param>
68 template<
typename TView,
typename Param>
97 int32
fFlags = ParameterInfo::kCanAutomate;
131 template<
typename ParamConverter,
typename... Args>
142 int32
fFlags = ParameterInfo::kCanAutomate;
173 template<
typename ParamSerializer,
typename... Args>
214 template<
typename ParamConverter,
typename... Args>
227 template<
typename ParamSerializer,
typename... Args>
244 template<
typename... Args>
265 template<
typename... Args>
297 virtual std::unique_ptr<NormalizedState>
newRTState()
const;
308 std::shared_ptr<IJmbParamDef>
getJmbParamDef(ParamID iParamID)
const;
332 tresult
addVstParamDef(std::shared_ptr<RawVstParamDef> iParamDef);
339 std::map<ParamID, std::shared_ptr<RawVstParamDef>>
fVstParams{};
342 std::map<ParamID, std::shared_ptr<IJmbParamDef>>
fJmbParams{};
356 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs) {
return kResultOk; }
359 template<
typename... Args>
360 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, ParamID
id, Args... args);
363 template<
typename... Args>
364 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<IJmbParamDef> &iParamDef, Args... args)
366 return buildParamIDs(iParamIDs, iParamDef->fParamID, args...);
370 template<
typename T,
typename... Args>
373 return buildParamIDs(iParamIDs, iParamDef->fParamID, args...);
377 template<
typename ParamConverver,
typename... Args>
380 return buildParamIDs(iParamIDs, iParamDef->fParamID, args...);
384 template<
typename... Args>
385 tresult
buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<RawVstParamDef> &iParamDef, Args... args)
387 return buildParamIDs(iParamIDs, iParamDef->fParamID, args...);
398 return fParameters->add(*
this);
407 return fParameters->add(*
this);
416 auto param = std::make_shared<VstParamDef<T>>(iBuilder.
fParamID,
430 DLOG_F(WARNING,
"No converter defined for non transient parameter [%d]", iBuilder.
fParamID);
445 auto param = std::make_shared<JmbParamDef<T>>(iBuilder.
fParamID,
455 DLOG_F(WARNING,
"No serializer defined for parameter [%d] (won't be able to be saved)", iBuilder.
fParamID);
460 DLOG_F(WARNING,
"No serializer defined for parameter [%d] (won't be able to be shared with peer)", iBuilder.
fParamID);
482 template<
typename ParamConverter,
typename... Args>
485 Args... iConverterArgs)
487 auto builder = vstFromType<typename ParamConverter::ParamType>(iParamID, iTitle);
488 builder.template converter<ParamConverter>(iConverterArgs...);
504 template<
typename ParamSerializer,
typename... Args>
507 Args... iSerializerArgs)
509 auto builder = jmbFromType<typename ParamSerializer::ParamType>(iParamID, iTitle);
510 builder.template serializer<ParamSerializer>(iSerializerArgs...);
517 template<
typename... Args>
520 tresult res = kResultOk;
525 iParamIDs.emplace_back(iParamID);
529 DLOG_F(ERROR,
"No such parameter [%d]", iParamID);
539 template<
typename... Args>
542 std::vector<ParamID> ids{};
550 template<
typename... Args>
553 std::vector<ParamID> ids{};
561 #endif // __PONGASOFT_VST_PARAMETERS_H__ tresult buildParamIDs(std::vector< ParamID > &iParamIDs, std::shared_ptr< JmbParamDef< T >> &iParamDef, Args... args)
Definition: Parameters.h:371
IParamDef::Owner fOwner
Definition: Parameters.h:101
std::map< ParamID, std::shared_ptr< IJmbParamDef > > fJmbParams
Definition: Parameters.h:342
Parameters * fParameters
Definition: Parameters.h:157
NormalizedState::SaveOrder fGUISaveStateOrder
Definition: Parameters.h:352
const TChar * fShortTitle
Definition: Parameters.h:144
Definition: Parameters.h:39
const TChar * fTitle
Definition: Parameters.h:139
const TChar * fShortTitle
Definition: Parameters.h:99
tresult setRTSaveStateOrder(int16 iVersion, Args... args)
Definition: Parameters.h:540
int32 fStepCount
Definition: Parameters.h:96
virtual void onParameterChange(ParamID iParamID)=0
JmbParamDefBuilder< typename ParamSerializer::ParamType > jmb(ParamID iParamID, const TChar *iTitle, Args... iSerializerArgs)
Definition: Parameters.h:505
std::shared_ptr< VstParamDef< T > > VstParam
Definition: ParamDef.h:358
std::shared_ptr< IParamSerializer< T > > fSerializer
Definition: Parameters.h:186
std::vector< ParamID > fAllRegistrationOrder
Definition: Parameters.h:348
ParamValue fDefaultValue
Definition: Parameters.h:95
std::shared_ptr< IJmbParamDef > getJmbParamDef(ParamID iParamID) const
Definition: Parameters.cpp:143
RawVstParamDefBuilder raw(ParamID iParamID, const TChar *iTitle)
Definition: Parameters.cpp:399
const TChar * fTitle
Definition: Parameters.h:181
RawVstParamDefBuilder & unitID(int32 iUnitID)
Definition: Parameters.h:81
VstParamDefBuilder & flags(int32 iFlags)
Definition: Parameters.h:123
VstParamDefBuilder & shortTitle(const TChar *iShortTitle)
Definition: Parameters.h:125
Definition: Parameters.h:74
Definition: ParamDisplay.h:33
UnitID fUnitID
Definition: Parameters.h:98
Definition: Parameters.h:164
T fDefaultValue
Definition: Parameters.h:141
tresult buildParamIDs(std::vector< ParamID > &iParamIDs)
Definition: Parameters.h:356
virtual ParamValue readNormalizedValue(ParamID iParamID, IBStreamer &iStreamer) const
Definition: Parameters.cpp:116
Definition: NormalizedState.h:44
tresult buildParamIDs(std::vector< ParamID > &iParamIDs, std::shared_ptr< VstParamDef< ParamConverver >> &iParamDef, Args... args)
Definition: Parameters.h:378
RawVstParamDefBuilder & defaultValue(ParamValue iDefaultValue)
Definition: Parameters.h:78
std::vector< ParamID > const & getAllRegistrationOrder() const
Definition: Parameters.h:314
JmbParamDefBuilder & rtOwned()
Definition: Parameters.h:169
IParamDef::Owner fOwner
Definition: Parameters.h:183
int32 fFlags
Definition: Parameters.h:142
tresult setGUISaveStateOrder(int16 iVersion, Args... args)
Definition: Parameters.h:551
ParamID fParamID
Definition: Parameters.h:138
std::shared_ptr< IParamConverter< T > > fConverter
Definition: Parameters.h:148
VstParamDefBuilder & converter(std::shared_ptr< IParamConverter< T >> iConverter)
Definition: Parameters.h:130
NormalizedState::SaveOrder const & getRTSaveStateOrder() const
Definition: Parameters.h:278
std::vector< ParamID > fVstRegistrationOrder
Definition: Parameters.h:345
VstParamDefBuilder & defaultValue(T const &iDefaultValue)
Definition: Parameters.h:122
VstParamDefBuilder & precision(int32 iPrecision)
Definition: Parameters.h:126
std::shared_ptr< JmbParamDef< T > > JmbParam
Definition: ParamDef.h:365
JmbParamDefBuilder & serializer(std::shared_ptr< IParamSerializer< T >> iSerializer)
Definition: Parameters.h:172
const TChar * fUnits
Definition: Parameters.h:140
RawVstParamDefBuilder & flags(int32 iFlags)
Definition: Parameters.h:80
bool fTransient
Definition: Parameters.h:147
tresult buildParamIDs(std::vector< ParamID > &iParamIDs, std::shared_ptr< RawVstParamDef > &iParamDef, Args... args)
Definition: Parameters.h:385
UnitID fUnitID
Definition: Parameters.h:143
Definition: NormalizedState.h:38
VstParam< T > add() const
Definition: Parameters.h:405
IParamDef::Owner fOwner
Definition: Parameters.h:146
JmbParamDefBuilder< T > jmbFromType(ParamID iParamID, const TChar *iTitle)
Definition: Parameters.h:496
tresult addVstParamDef(std::shared_ptr< RawVstParamDef > iParamDef)
Definition: Parameters.cpp:155
JmbParamDefBuilder & serializer(Args... iArgs)
Definition: Parameters.h:174
const TChar * fUnits
Definition: Parameters.h:94
RawVstParamDefBuilder & guiOwned()
Definition: Parameters.h:85
NormalizedState::SaveOrder const & getGUISaveStateOrder() const
Definition: Parameters.h:256
VstParamDefBuilder & unitID(int32 iUnitID)
Definition: Parameters.h:124
virtual tresult writeRTState(NormalizedState const *iNormalizedState, IBStreamer &oStreamer) const
Definition: Parameters.cpp:107
RawVstParamDefBuilder & units(const TChar *iUnits)
Definition: Parameters.h:77
RawVstParamDefBuilder & precision(int32 iPrecision)
Definition: Parameters.h:83
RawVstParamDefBuilder & shortTitle(const TChar *iShortTitle)
Definition: Parameters.h:82
RawVstParam add(RawVstParamDefBuilder const &iBuilder)
Definition: Parameters.cpp:376
std::shared_ptr< RawVstParamDef > RawVstParam
Definition: ParamDef.h:359
std::function< void()> ChangeCallback
Definition: Parameters.h:57
VstParamDefBuilder & guiOwned()
Definition: Parameters.h:128
bool fTransient
Definition: Parameters.h:102
Parameters * fParameters
Definition: Parameters.h:195
JmbParamDefBuilder(Parameters *iParameters, ParamID iParamID, const TChar *iTitle)
Definition: Parameters.h:191
RawVstParamDefBuilder(Parameters *iParameters, ParamID iParamID, const TChar *iTitle)
Definition: Parameters.h:107
VstParamDefBuilder< typename ParamConverter::ParamType > vst(ParamID iParamID, const TChar *iTitle, Args... iConverterArgs)
Definition: Parameters.h:483
std::shared_ptr< RawVstParamDef > getRawVstParamDef(ParamID iParamID) const
Definition: Parameters.cpp:131
JmbParamDefBuilder & guiOwned()
Definition: Parameters.h:170
tresult buildParamIDs(std::vector< ParamID > &iParamIDs, std::shared_ptr< IJmbParamDef > &iParamDef, Args... args)
Definition: Parameters.h:364
Definition: ParamSerializers.h:43
bool fTransient
Definition: Parameters.h:184
Owner
Definition: ParamDef.h:45
JmbParamDefBuilder & defaultValue(T const &iDefaultValue)
Definition: Parameters.h:167
RawVstParamDefBuilder & stepCount(int32 iStepCount)
Definition: Parameters.h:79
RawVstParamDefBuilder & rtOwned()
Definition: Parameters.h:84
bool fShared
Definition: Parameters.h:185
virtual ~Parameters()=default
void registerVstParameters(Vst::ParameterContainer &iParameterContainer) const
Definition: Parameters.cpp:56
ParamID fParamID
Definition: Parameters.h:92
T fDefaultValue
Definition: Parameters.h:182
int32 fPrecision
Definition: Parameters.h:100
JmbParam< T > add() const
Definition: Parameters.h:396
ParamID fParamID
Definition: Parameters.h:180
RawVstParam add() const
Definition: Parameters.cpp:368
VstParamDefBuilder & converter(Args... iArgs)
Definition: Parameters.h:132
std::vector< ParamID > const & getVstRegistrationOrder() const
Definition: Parameters.h:311
VstParamDefBuilder(Parameters *iParameters, ParamID iParamID, const TChar *iTitle)
Definition: Parameters.h:153
Definition: ParamDef.h:129
const TChar * fTitle
Definition: Parameters.h:93
std::map< ParamID, std::shared_ptr< RawVstParamDef > > fVstParams
Definition: Parameters.h:339
Parameters * fParameters
Definition: Parameters.h:111
virtual tresult readRTState(IBStreamer &iStreamer, NormalizedState *oNormalizedState) const
Definition: Parameters.cpp:87
VstParamDefBuilder< T > vstFromType(ParamID iParamID, const TChar *iTitle)
Definition: Parameters.h:474
VstParamDefBuilder & rtOwned()
Definition: Parameters.h:127
virtual std::unique_ptr< NormalizedState > newRTState() const
Definition: Parameters.cpp:68
NormalizedState::SaveOrder fRTSaveStateOrder
Definition: Parameters.h:351
tresult addJmbParamDef(std::shared_ptr< IJmbParamDef > iParamDef)
Definition: Parameters.cpp:190
Definition: ParamDef.h:225
std::function< void(Param &)> ChangeCallback1
Definition: Parameters.h:63
VstParamDefBuilder & units(const TChar *iUnits)
Definition: Parameters.h:121
int32 fPrecision
Definition: Parameters.h:145
JmbParamDefBuilder & shared(bool iShared=true)
Definition: Parameters.h:171
Definition: Parameters.h:118
Definition: Parameters.h:45
int32 fFlags
Definition: Parameters.h:97
Definition: ParamConverters.h:50
std::function< void(TView *, Param &)> ChangeCallback2
Definition: Parameters.h:69