SynthLab SDK
|
If you are using the SynthEngine, you update the GUI parameters by first requesting a shared pointer to the engine's parameter structure, which will contain parameters relevant to the engine level of operation. It also contains a shared pointer to the voice parameter structure. You use these two pointers directly to update all of the engine, voice and module parameters. Notice that this is part of SynthLab's shared parameter paradigm that was baked into the design from the very beginning. If you don't like it, you may freely replace it with another scheme for sharing these parameters while still retaining the code for decoding MIDI and rendering note events from voices.
In my implementations, the ASPiK framework's processing object declares and stores these two pointers - they are guaranteed to never change during the life of the engine because my processing object (PluginCore) insantiates one and only one engine object for the life of the plugin. However, they may also be obtained on-the-fly during each GUI update phase depending on your coding preference.
With the two shared pointers in hand, you can update all of the bits and pieces of the synth, with all redundant data being shared across all identical objects. For example, it your engine has 16 voice objects in its array, and each includes an LFO named LFO1, then the LFO GUI parameters (rate, waveform, output amplitude, etc...) are common to all LFO1s in the voices. The shared parameter pointers allow access to them at once without copying pointers or copying parameter data. Here are some code fragmements showing various GUI updating for the example synths. Of course these GUI variables would be coming from your impelmentation and would likely not have the same names, so I replaced my variable names with raw numbers as examples only.
Engine Parameters
Voice Parameters
SynthModule Parameters shared via the voice parameter struct
ModMatrix Parameters shared via the voice parameter struct
The Modulation Matrix object's parameter structure also contains both variables and functions to allow matrix manipulation from your GUI code. These functions take modulation array index values, shown as constants here and defined in synthconstants.h for the example synths. The functions allow setting the intensity controls and enabling/disabling particular modulation routings. Here are some code fragmements showing mod matrix parameter function calls from the example synths, this time they show my GUI variable names. You access the modMatrixParameters via the voiceParameters:
voiceParameters->modMatrixParameters
Here are some things to remember and think about:
the SynthModules in the voice will be updating during the render cycle as with the standalone objects; remember that their parameter structures are shared and given to them at instantiation time