SynthLab SDK
|
Next we will create the SynthLab::EnvelopeGenerator object that is also derived from SynthModule.
You will need to add the following files for the EnvelopeGenerator:
Follow the same pattern and start with the class documentation. The AnalogEG:
We'll go with the default AnalogEGCore object and jump to its documentation. There we can find the module strings and mod knob assignments. The ModuleStrings are the EG contours.
Module Strings, zero-indexed for your GUI Control:
We will choose the familiar ADSR contour, which as a zero-indexed string entry is [0]. Next, look at the documentation to find the output data (render) location
From the docs on AnalogEGCore:
Note that the documentation also shows you how to create the object in standalone mode, as with the LFO:
So, we will do the following:
Now, in response to a MIDI note-on message, we setup a MIDIEvent structure and call the member function:
At this point, we can start to render values from the EG and grab them from the ModulationOutput array for the normal EG output:
From here you can keep rendering until the note-off message arrives:
Now, experiment with changing the EG parameters (see the EGParameter documentation to see what you can change). Also, try experimenting with the mod knobs (see SynthLFO tutorial above)