SynthLab SDK
|
All of the SynthModule objects use a pre-defined custom data structure specifically for object parameters that may be changed via the GUI or programmatically. This structure is NOT for modulation which is done with separate modulation arrays. You can think of the "parameters" as anything that could be connected to a GUI control for the user. On occasion, you will see use of the parameters to hold cooked values from GUI control, that are used later in the module's render operation.
You will use the parameter structure to update the object as a result of GUI manipulation, or to progammatically set values without (or in addition to) the GUI. All SynthModules feature the same-named function called getParameters( ) which returns a std::shared_ptr to the parameter structure. The type of pointer returned depends on the owning object; the SynthLFO object uses the LFOParameters structure. All of the custom parameter structures are coded in the synthlabparams.h file along with constants used specifically with them. For example, the LFOParameters transmits a waveform index value that indicates the LFO waveform that the user has chosen. To make the code easier to read and maintain, a strongly typed enum is defined for the waveforms:
Although the strongly typed enum has an underlying int datatype, it has to be specifically cast in order to make comparisons with it, so I have defined a macro to make that comparison:
Regardless of how you implement the object (stand-alone or not) you get the parameter structure the same way. So, for each object you will also want to look at the custom parameter structure to see what values you can manipulate and what GUI controls you can present to the user.
Here's the LFOParameter structure; each of these variable may map to a GUI control:
In the tutorials that follow, we will generally use these parameter structures to initialize the objects and to send "fake" GUI control change values into the object; of course you will ultimately connect these parameters to your GUI controls.