Jamba C++ API  4.0.0
Parameters.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2019 pongasoft
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  *
16  * @author Yan Pujante
17  */
18 #pragma once
19 
20 #include "ParamDef.h"
21 #include "NormalizedState.h"
22 
23 #include <map>
24 #include <vector>
25 #include <set>
26 #include <functional>
27 
28 #include <public.sdk/source/vst/vstparameters.h>
29 
30 namespace pongasoft::VST {
31 
32 namespace Debug { class ParamDisplay; }
33 
38 {
39 public:
44  {
45  public:
46  virtual void onParameterChange(ParamID iParamID) = 0;
47  };
48 
55  using ChangeCallback = std::function<void()>;
56 
60  template<typename Param>
61  using ChangeCallback1 = std::function<void(Param &)>;
62 
66  template<typename TView, typename Param>
67  using ChangeCallback2 = std::function<void(TView *, Param &)>;
68 
69 public:
73  {
74  // builder methods
75  RawVstParamDefBuilder &units(VstString16 iUnits) { fUnits = iUnits; return *this; }
76  RawVstParamDefBuilder &defaultValue(ParamValue iDefaultValue) { fDefaultValue = iDefaultValue; return *this;}
77  RawVstParamDefBuilder &stepCount(int32 iStepCount) { fStepCount = iStepCount; return *this;}
78  RawVstParamDefBuilder &flags(int32 iFlags) { fFlags = iFlags; return *this; }
79  RawVstParamDefBuilder &unitID(int32 iUnitID) { fUnitID = iUnitID; return *this; }
80  RawVstParamDefBuilder &shortTitle(VstString16 iShortTitle) { fShortTitle = iShortTitle; return *this; }
81  RawVstParamDefBuilder &precision(int32 iPrecision) { fPrecision = iPrecision; return *this; }
82  RawVstParamDefBuilder &rtOwned() { fOwner = IParamDef::Owner::kRT; return *this; }
83  RawVstParamDefBuilder &guiOwned() { fOwner = IParamDef::Owner::kGUI; return *this; }
84  RawVstParamDefBuilder &transient(bool iTransient = true) { fTransient = iTransient; return *this; }
85 
86  // parameter factory method
87  RawVstParam add() const;
88 
89  // fields
90  ParamID fParamID;
93  ParamValue fDefaultValue{};
94  int32 fStepCount{0};
95  int32 fFlags = ParameterInfo::kCanAutomate;
96  UnitID fUnitID = kRootUnitId;
98  int32 fPrecision = 4;
99  IParamDef::Owner fOwner = IParamDef::Owner::kRT;
100  bool fTransient = false;
101 
102  friend class Parameters;
103 
104  protected:
105  RawVstParamDefBuilder(Parameters *iParameters, ParamID iParamID, VstString16 iTitle) :
106  fParamID{iParamID}, fTitle{std::move(iTitle)}, fParameters{iParameters} {}
107 
108  private:
110  };
111 
115  template<typename T>
117  {
118  // builder methods
119  VstParamDefBuilder &units(VstString16 iUnits) { fUnits = iUnits; return *this; }
120  VstParamDefBuilder &defaultValue(T const &iDefaultValue) { fDefaultValue = iDefaultValue; return *this;}
121  VstParamDefBuilder &flags(int32 iFlags) { fFlags = iFlags; return *this; }
122  VstParamDefBuilder &unitID(int32 iUnitID) { fUnitID = iUnitID; return *this; }
123  VstParamDefBuilder &shortTitle(VstString16 iShortTitle) { fShortTitle = iShortTitle; return *this; }
124  VstParamDefBuilder &precision(int32 iPrecision) { fPrecision = iPrecision; return *this; }
125  VstParamDefBuilder &rtOwned() { fOwner = IParamDef::Owner::kRT; return *this; }
126  VstParamDefBuilder &guiOwned() { fOwner = IParamDef::Owner::kGUI; return *this; }
127  VstParamDefBuilder &transient(bool iTransient = true) { fTransient = iTransient; return *this; }
128  VstParamDefBuilder &converter(std::shared_ptr<IParamConverter<T>> iConverter) { fConverter = std::move(iConverter); return *this; }
129  template<typename ParamConverter, typename... Args>
130  VstParamDefBuilder &converter(Args&& ...iArgs) { fConverter = std::make_shared<ParamConverter>(std::forward<Args>(iArgs)...); return *this; }
131 
132  // parameter factory method
133  VstParam<T> add() const;
134 
135  // fields
136  ParamID fParamID;
140  int32 fFlags = ParameterInfo::kCanAutomate;
141  UnitID fUnitID = kRootUnitId;
143  int32 fPrecision = 4;
144  IParamDef::Owner fOwner = IParamDef::Owner::kRT;
145  bool fTransient = false;
146  std::shared_ptr<IParamConverter<T>> fConverter{};
147 
148  friend class Parameters;
149 
150  protected:
151  VstParamDefBuilder(Parameters *iParameters, ParamID iParamID, VstString16 iTitle) :
152  fParamID{iParamID}, fTitle{std::move(iTitle)}, fParameters{iParameters} {}
153 
154  private:
156  };
157 
161  template<typename T>
163  {
164  // builder methods
165  JmbParamDefBuilder &defaultValue(T const &iDefaultValue) { fDefaultValue = iDefaultValue; return *this;}
166  JmbParamDefBuilder &transient(bool iTransient = true) { fTransient = iTransient; return *this; }
167  JmbParamDefBuilder &rtOwned() { fOwner = IParamDef::Owner::kRT; return *this; }
168  JmbParamDefBuilder &guiOwned() { fOwner = IParamDef::Owner::kGUI; return *this; }
169  JmbParamDefBuilder &shared(bool iShared = true) { fShared = iShared; return *this; }
170  JmbParamDefBuilder &serializer(std::shared_ptr<IParamSerializer<T>> iSerializer) { fSerializer = std::move(iSerializer); return *this; }
171  template<typename ParamSerializer, typename... Args>
172  JmbParamDefBuilder &serializer(Args&& ...iArgs) { fSerializer = std::make_shared<ParamSerializer>(std::forward<Args>(iArgs)...); return *this; }
173 
174  // parameter factory method
175  JmbParam<T> add() const;
176 
177  // fields
178  ParamID fParamID;
181  IParamDef::Owner fOwner = IParamDef::Owner::kGUI;
182  bool fTransient = false;
183  bool fShared = false;
184  std::shared_ptr<IParamSerializer<T>> fSerializer{};
185 
186  friend class Parameters;
187 
188  protected:
189  JmbParamDefBuilder(Parameters *iParameters, ParamID iParamID, VstString16 iTitle) :
190  fParamID{iParamID}, fTitle{std::move(iTitle)}, fParameters{iParameters} {}
191 
192  private:
194  };
195 
196 public:
197  // Constructor
198  explicit Parameters() = default;
199 
200  // Ensure the class is polymorphinc
201  virtual ~Parameters() = default;
202 
203 
207  RawVstParamDefBuilder raw(ParamID iParamID, VstString16 iTitle);
208 
212  template<typename ParamConverter, typename... Args>
213  VstParamDefBuilder<typename ParamConverter::ParamType> vst(ParamID iParamID, VstString16 iTitle, Args&& ...iConverterArgs);
214 
218  template<typename ParamConverter>
220  VstString16 iTitle,
221  typename ParamConverter::ConstructorType initValue);
222 
227  template<typename T>
228  VstParamDefBuilder<T> vstFromType(ParamID iParamID, VstString16 iTitle);
229 
233  template<typename ParamSerializer, typename... Args>
234  JmbParamDefBuilder<typename ParamSerializer::ParamType> jmb(ParamID iParamID, VstString16 iTitle, Args&& ...iSerializerArgs);
235 
239  template<typename ParamSerializer>
241  VstString16 iTitle,
242  typename ParamSerializer::ConstructorType initValue);
243 
248  template<typename T>
249  JmbParamDefBuilder<T> jmbFromType(ParamID iParamID, VstString16 iTitle);
250 
258  template<typename... Args>
259  tresult setRTSaveStateOrder(int16 iVersion, Args&& ...args);
260 
265  tresult setRTSaveStateOrder(NormalizedState::SaveOrder const &iSaveOrder);
266 
271 
279  template<typename... Args>
280  tresult setGUISaveStateOrder(int16 iVersion, Args&& ...args);
281 
286  tresult setGUISaveStateOrder(NormalizedState::SaveOrder const &iSaveOrder);
287 
293 
298  void registerVstParameters(Vst::ParameterContainer &iParameterContainer) const;
299 
302  virtual tresult readRTState(IBStreamer &iStreamer, NormalizedState *oNormalizedState) const;
303 
306  virtual tresult writeRTState(NormalizedState const *iNormalizedState, IBStreamer &oStreamer) const;
307 
311  virtual std::unique_ptr<NormalizedState> newRTState() const;
312 
316  virtual ParamValue readNormalizedValue(ParamID iParamID, IBStreamer &iStreamer) const;
317 
318  // getParamDef - nullptr when not found
319  std::shared_ptr<RawVstParamDef> getRawVstParamDef(ParamID iParamID) const;
320 
321  // getJmbParamDef - nullptr when not found
322  std::shared_ptr<IJmbParamDef> getJmbParamDef(ParamID iParamID) const;
323 
324  // getVstRegistrationOrder
325  std::vector<ParamID> const &getVstRegistrationOrder() const { return fVstRegistrationOrder; }
326 
327  // getAllRegistrationOrder
328  std::vector<ParamID> const &getAllRegistrationOrder() const { return fAllRegistrationOrder; }
329 
330  // gives access for debug
331  friend class Debug::ParamDisplay;
332 
333 protected:
334  // internally called by the builder
335  RawVstParam add(RawVstParamDefBuilder const &iBuilder);
336 
337  // internally called by the builder
338  template<typename T>
339  VstParam<T> add(VstParamDefBuilder<T> const &iBuilder);
340 
341  // internally called by the builder
342  template<typename T>
343  JmbParam<T> add(JmbParamDefBuilder<T> const &iBuilder);
344 
345  // addVstParamDef
346  tresult addVstParamDef(std::shared_ptr<RawVstParamDef> iParamDef);
347 
348  // addJmbParamDef
349  tresult addJmbParamDef(std::shared_ptr<IJmbParamDef> iParamDef);
350 
351 private:
352  // contains all the registered (raw type) parameters (unique ID, will be checked on add)
353  std::map<ParamID, std::shared_ptr<RawVstParamDef>> fVstParams{};
354 
355  // contains all the registered (serializable type) parameters (unique ID, will be checked on add)
356  std::map<ParamID, std::shared_ptr<IJmbParamDef>> fJmbParams{};
357 
358  // order in which the parameters will be registered in the vst world
359  std::vector<ParamID> fVstRegistrationOrder{};
360 
361  // order in which the parameters were registered
362  std::vector<ParamID> fAllRegistrationOrder{};
363 
367 
368 private:
369  // leaf of templated calls to build a list of ParamIDs from ParamID or ParamDefs
370  tresult buildParamIDs(std::vector<ParamID> &iParamIDs) { return kResultOk; }
371 
372  // case when ParamID
373  template<typename... Args>
374  tresult buildParamIDs(std::vector<ParamID> &iParamIDs, ParamID id, Args&& ...args);
375 
376  // case when IJmbParamDef
377  template<typename... Args>
378  tresult buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<IJmbParamDef> &iParamDef, Args&& ...args)
379  {
380  return buildParamIDs(iParamIDs, iParamDef->fParamID, std::forward<Args>(args)...);
381  }
382 
383  // case when IJmbParamDef
384  template<typename T, typename... Args>
385  tresult buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<JmbParamDef<T>> &iParamDef, Args&& ...args)
386  {
387  return buildParamIDs(iParamIDs, iParamDef->fParamID, std::forward<Args>(args)...);
388  }
389 
390  // case when VstParamDef
391  template<typename ParamConverver, typename... Args>
392  tresult buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<VstParamDef<ParamConverver>> &iParamDef, Args&& ...args)
393  {
394  return buildParamIDs(iParamIDs, iParamDef->fParamID, std::forward<Args>(args)...);
395  }
396 
397  // case when RawVstParamDef
398  template<typename... Args>
399  tresult buildParamIDs(std::vector<ParamID> &iParamIDs, std::shared_ptr<RawVstParamDef> &iParamDef, Args&& ...args)
400  {
401  return buildParamIDs(iParamIDs, iParamDef->fParamID, std::forward<Args>(args)...);
402  }
403 
404 };
405 
406 //------------------------------------------------------------------------
407 // Parameters::JmbParamDefBuilder::add
408 //------------------------------------------------------------------------
409 template<typename T>
411 {
412  return fParameters->add(*this);
413 }
414 
415 //------------------------------------------------------------------------
416 // Parameters::VstParamDefBuilder::add
417 //------------------------------------------------------------------------
418 template<typename T>
420 {
421  return fParameters->add(*this);
422 }
423 
424 //------------------------------------------------------------------------
425 // Parameters::add (called by the builder)
426 //------------------------------------------------------------------------
427 template<typename T>
428 VstParam<T> Parameters::add(VstParamDefBuilder<T> const &iBuilder)
429 {
430  auto param = std::make_shared<VstParamDef<T>>(iBuilder.fParamID,
431  iBuilder.fTitle,
432  iBuilder.fUnits,
433  iBuilder.fDefaultValue,
434  iBuilder.fFlags,
435  iBuilder.fUnitID,
436  iBuilder.fShortTitle,
437  iBuilder.fPrecision,
438  iBuilder.fOwner,
439  iBuilder.fTransient,
440  iBuilder.fConverter);
441 
442  if(!iBuilder.fTransient && !iBuilder.fConverter)
443  {
444  DLOG_F(WARNING, "No converter defined for non transient parameter [%d]", iBuilder.fParamID);
445  }
446 
447  if(addVstParamDef(param) == kResultOk)
448  return param;
449  else
450  return nullptr;
451 }
452 
453 //------------------------------------------------------------------------
454 // Parameters::add (called by the builder)
455 //------------------------------------------------------------------------
456 template<typename T>
458 {
459  auto param = std::make_shared<JmbParamDef<T>>(iBuilder.fParamID,
460  iBuilder.fTitle,
461  iBuilder.fOwner,
462  iBuilder.fTransient,
463  iBuilder.fShared,
464  iBuilder.fDefaultValue,
465  iBuilder.fSerializer);
466 
467  if(!iBuilder.fTransient && !iBuilder.fSerializer)
468  {
469  DLOG_F(WARNING, "No serializer defined for parameter [%d] (won't be able to be saved)", iBuilder.fParamID);
470  }
471 
472  if(iBuilder.fShared && !iBuilder.fSerializer)
473  {
474  DLOG_F(WARNING, "No serializer defined for parameter [%d] (won't be able to be shared with peer)", iBuilder.fParamID);
475  }
476 
477  if(addJmbParamDef(param) == kResultOk)
478  return param;
479  else
480  return nullptr;
481 }
482 
483 
484 //------------------------------------------------------------------------
485 // Parameters::vstFromType
486 //------------------------------------------------------------------------
487 template<typename T>
489 {
490  return Parameters::VstParamDefBuilder<T>(this, iParamID, std::move(iTitle));
491 }
492 
493 //------------------------------------------------------------------------
494 // Parameters::vst
495 //------------------------------------------------------------------------
496 template<typename ParamConverter, typename... Args>
498  VstString16 iTitle,
499  Args&& ...iConverterArgs)
500 {
501  auto builder = vstFromType<typename ParamConverter::ParamType>(iParamID, std::move(iTitle));
502  builder.template converter<ParamConverter>(std::forward<Args>(iConverterArgs)...);
503  return builder;
504 }
505 
506 //------------------------------------------------------------------------
507 // Parameters::vst
508 //------------------------------------------------------------------------
509 template<typename ParamConverter>
511  VstString16 iTitle,
512  typename ParamConverter::ConstructorType initValue) {
513  auto builder = vstFromType<typename ParamConverter::ParamType>(iParamID, std::move(iTitle));
514  builder.template converter<ParamConverter>(initValue);
515  return builder;
516 }
517 
518 //------------------------------------------------------------------------
519 // Parameters::jmbFromType
520 //------------------------------------------------------------------------
521 template<typename T>
523 {
524  return Parameters::JmbParamDefBuilder<T>(this, iParamID, std::move(iTitle));
525 }
526 
527 //------------------------------------------------------------------------
528 // Parameters::jmb
529 //------------------------------------------------------------------------
530 template<typename ParamSerializer, typename... Args>
532  VstString16 iTitle,
533  Args&& ...iSerializerArgs)
534 {
535  auto builder = jmbFromType<typename ParamSerializer::ParamType>(iParamID, std::move(iTitle));
536  builder.template serializer<ParamSerializer>(std::forward<Args>(iSerializerArgs)...);
537  return builder;
538 }
539 
540 //------------------------------------------------------------------------
541 // Parameters::jmb
542 //------------------------------------------------------------------------
543 template<typename ParamSerializer>
545  VstString16 iTitle,
546  typename ParamSerializer::ConstructorType initValue) {
547  auto builder = jmbFromType<typename ParamSerializer::ParamType>(iParamID, std::move(iTitle));
548  builder.template serializer<ParamSerializer>(initValue);
549  return builder;
550 }
551 
552 //------------------------------------------------------------------------
553 // Parameters::buildParamIDs
554 //------------------------------------------------------------------------
555 template<typename... Args>
556 tresult Parameters::buildParamIDs(std::vector<ParamID> &iParamIDs, ParamID iParamID, Args&& ...args)
557 {
558  tresult res = kResultOk;
559 
560  if(fVstParams.find(iParamID) != fVstParams.cend() ||
561  fJmbParams.find(iParamID) != fJmbParams.cend())
562  {
563  iParamIDs.emplace_back(iParamID);
564  }
565  else
566  {
567  DLOG_F(ERROR, "No such parameter [%d]", iParamID);
568  res = kResultFalse;
569  }
570  res |= buildParamIDs(iParamIDs, std::forward<Args>(args)...);
571  return res;
572 }
573 
574 //------------------------------------------------------------------------
575 // Parameters::setRTSaveStateOrder
576 //------------------------------------------------------------------------
577 template<typename... Args>
578 tresult Parameters::setRTSaveStateOrder(int16 iVersion, Args&& ...args)
579 {
580  std::vector<ParamID> ids{};
581  buildParamIDs(ids, std::forward<Args>(args)...);
582  return setRTSaveStateOrder({iVersion, ids});
583 }
584 
585 //------------------------------------------------------------------------
586 // Parameters::setRTSaveStateOrder
587 //------------------------------------------------------------------------
588 template<typename... Args>
589 tresult Parameters::setGUISaveStateOrder(int16 iVersion, Args&& ...args)
590 {
591  std::vector<ParamID> ids{};
592  buildParamIDs(ids, std::forward<Args>(args)...);
593  return setGUISaveStateOrder({iVersion, ids});
594 }
595 
596 }
VstParamDefBuilder & converter(std::shared_ptr< IParamConverter< T >> iConverter)
Definition: Parameters.h:128
std::shared_ptr< IParamConverter< T > > fConverter
Definition: Parameters.h:146
std::vector< ParamID > const & getAllRegistrationOrder() const
Definition: Parameters.h:328
std::shared_ptr< IParamSerializer< T > > fSerializer
Definition: Parameters.h:184
VstString16 fShortTitle
Definition: Parameters.h:142
VstString16 fShortTitle
Definition: Parameters.h:97
This is the class which maintains all the registered parameters.
Definition: Parameters.h:37
virtual ~Parameters()=default
VstString16 fUnits
Definition: Parameters.h:138
VstString16 fTitle
Definition: Parameters.h:137
int32 fFlags
Definition: Parameters.h:140
VstString16 fTitle
Definition: Parameters.h:91
NormalizedState::SaveOrder const & getRTSaveStateOrder() const
Definition: Parameters.h:292
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:589
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:142
Implements the builder pattern for ease of build.
Definition: Parameters.h:162
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:578
Maintains the order used to save/restore the RT and GUI state.
Definition: NormalizedState.h:44
std::shared_ptr< RawVstParamDef > RawVstParam
Definition: ParamDef.h:444
ParamID fParamID
Definition: Parameters.h:178
virtual ParamValue readNormalizedValue(ParamID iParamID, IBStreamer &iStreamer) const
Definition: Parameters.cpp:115
VstParamDefBuilder & converter(Args &&...iArgs)
Definition: Parameters.h:130
RawVstParamDefBuilder & shortTitle(VstString16 iShortTitle)
Definition: Parameters.h:80
bool fTransient
Definition: Parameters.h:145
VstParamDefBuilder & precision(int32 iPrecision)
Definition: Parameters.h:124
int32 fPrecision
Definition: Parameters.h:98
virtual tresult readRTState(IBStreamer &iStreamer, NormalizedState *oNormalizedState) const
This method is called to read the RTState from the stream.
Definition: Parameters.cpp:86
ParamValue fDefaultValue
Definition: Parameters.h:93
int32 fFlags
Definition: Parameters.h:95
VstParamDefBuilder & unitID(int32 iUnitID)
Definition: Parameters.h:122
std::vector< ParamID > fVstRegistrationOrder
Definition: Parameters.h:359
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:365
RawVstParam add(RawVstParamDefBuilder const &iBuilder)
Definition: Parameters.cpp:376
Used to communicate the state between the UI and the RT and read/write to stream.
Definition: NormalizedState.h:38
NormalizedState::SaveOrder fGUISaveStateOrder
Definition: Parameters.h:366
Parameters * fParameters
Definition: Parameters.h:155
std::shared_ptr< RawVstParamDef > getRawVstParamDef(ParamID iParamID) const
Definition: Parameters.cpp:130
std::vector< ParamID > fAllRegistrationOrder
Definition: Parameters.h:362
UnitID fUnitID
Definition: Parameters.h:96
VstParamDefBuilder & flags(int32 iFlags)
Definition: Parameters.h:121
int32 fPrecision
Definition: Parameters.h:143
tresult buildParamIDs(std::vector< ParamID > &iParamIDs)
Definition: Parameters.h:370
Parameters * fParameters
Definition: Parameters.h:193
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:172
VstString16 fUnits
Definition: Parameters.h:92
tresult buildParamIDs(std::vector< ParamID > &iParamIDs, std::shared_ptr< RawVstParamDef > &iParamDef, Args &&...args)
Definition: Parameters.h:399
std::vector< ParamID > const & getVstRegistrationOrder() const
Definition: Parameters.h:325
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:531
RawVstParamDefBuilder & units(VstString16 iUnits)
Definition: Parameters.h:75
RawVstParamDefBuilder & rtOwned()
Definition: Parameters.h:82
int32 fStepCount
Definition: Parameters.h:94
RawVstParamDefBuilder(Parameters *iParameters, ParamID iParamID, VstString16 iTitle)
Definition: Parameters.h:105
Parameters * fParameters
Definition: Parameters.h:109
UnitID fUnitID
Definition: Parameters.h:141
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:385
JmbParamDefBuilder & defaultValue(T const &iDefaultValue)
Definition: Parameters.h:165
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:522
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:125
VstString16 fTitle
Definition: Parameters.h:179
virtual void onParameterChange(ParamID iParamID)=0
NormalizedState::SaveOrder const & getGUISaveStateOrder() const
Definition: Parameters.h:270
bool fTransient
Definition: Parameters.h:100
JmbParamDefBuilder & rtOwned()
Definition: Parameters.h:167
RawVstParam add() const
Definition: Parameters.cpp:368
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:497
RawVstParamDefBuilder & defaultValue(ParamValue iDefaultValue)
Definition: Parameters.h:76
VstParamDefBuilder< T > vstFromType(ParamID iParamID, VstString16 iTitle)
Used from derived classes to build a parameter backed by a VST parameter.
Definition: Parameters.h:488
VstParam< T > add() const
Definition: Parameters.h:419
tresult addVstParamDef(std::shared_ptr< RawVstParamDef > iParamDef)
Definition: Parameters.cpp:155
JmbParamDefBuilder & serializer(std::shared_ptr< IParamSerializer< T >> iSerializer)
Definition: Parameters.h:170
RawVstParamDefBuilder & stepCount(int32 iStepCount)
Definition: Parameters.h:77
JmbParamDefBuilder & shared(bool iShared=true)
Definition: Parameters.h:169
tresult buildParamIDs(std::vector< ParamID > &iParamIDs, std::shared_ptr< IJmbParamDef > &iParamDef, Args &&...args)
Definition: Parameters.h:378
VstParamDefBuilder & defaultValue(T const &iDefaultValue)
Definition: Parameters.h:120
T fDefaultValue
Definition: Parameters.h:180
ParamID fParamID
Definition: Parameters.h:90
RawVstParamDefBuilder raw(ParamID iParamID, VstString16 iTitle)
Used from derived classes to build a parameter backed by a raw VST parameter.
Definition: Parameters.cpp:399
JmbParamDefBuilder & guiOwned()
Definition: Parameters.h:168
virtual tresult writeRTState(NormalizedState const *iNormalizedState, IBStreamer &oStreamer) const
This method is called to write the NormalizedState to the stream.
Definition: Parameters.cpp:106
IParamDef::Owner fOwner
Definition: Parameters.h:181
JmbParam< T > add() const
Definition: Parameters.h:410
ParamID fParamID
Definition: Parameters.h:136
Definition: Clock.h:23
tresult buildParamIDs(std::vector< ParamID > &iParamIDs, std::shared_ptr< VstParamDef< ParamConverver >> &iParamDef, Args &&...args)
Definition: Parameters.h:392
RawVstParamDefBuilder & guiOwned()
Definition: Parameters.h:83
VstParamDefBuilder & units(VstString16 iUnits)
Definition: Parameters.h:119
IParamDef::Owner fOwner
Definition: Parameters.h:99
bool fTransient
Definition: Parameters.h:182
tresult addJmbParamDef(std::shared_ptr< IJmbParamDef > iParamDef)
Definition: Parameters.cpp:190
JmbParamDefBuilder(Parameters *iParameters, ParamID iParamID, VstString16 iTitle)
Definition: Parameters.h:189
VstParamDefBuilder(Parameters *iParameters, ParamID iParamID, VstString16 iTitle)
Definition: Parameters.h:151
VstParamDefBuilder & shortTitle(VstString16 iShortTitle)
Definition: Parameters.h:123
T fDefaultValue
Definition: Parameters.h:139
IParamDef::Owner fOwner
Definition: Parameters.h:144
Implements the builder pattern for ease of build.
Definition: Parameters.h:116
std::map< ParamID, std::shared_ptr< IJmbParamDef > > fJmbParams
Definition: Parameters.h:356
Interface to implement to receive parameter changes.
Definition: Parameters.h:43
bool fShared
Definition: Parameters.h:183
A vst parameter is represented by a ParamValue type which is a double in the range [0,...
Definition: ParamConverters.h:53
std::map< ParamID, std::shared_ptr< RawVstParamDef > > fVstParams
Definition: Parameters.h:353
VstParamDefBuilder & guiOwned()
Definition: Parameters.h:126