SynthLab SDK
|
Start with the SynthLab::LFO object that is derived from SynthModule. This object is usually part of a synth so we will pretend that is the case here, and setup the LFO and use it with a fake MIDI event to test it - then, you may connect it to your own plugin framework project and test it with real MIDI.
You will need to add the following files for the SynthLFO:
Looking at the class documentation, you can see that the LFO:
We'll go with the default LFOCore object and jump to its documentation. There we can find the module strings and mod knob assignments (see class documentation - the "more..." text)
Module Strings, zero-indexed for your GUI Control:
We will choose the ramp_up waveform, which as a zero-indexed string entry is [2]. Next; look at the documentation to find the output data (render) location
From the docs on LFOCore:
This code shows you how to create the LFO object with a shared pointer that will auto-delete when not needed. This is the way objects are shared in SynthLab. First, look at the LFO constructor to see its shared database arguments:
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 LFO and grab them from the ModulationOutput array for the normal LFO output:
From here you can keep rendering until the note-off message arrives:
Now, experiment with changing the LFO parameters (see the LFOParameter documentation to see what you can change). Also, try experimenting with the mod knobs. These all take unipolar values from [0.0, +1.0]. You set them along with the other parameters whenever you update the object. Here, we will select the waveform at index location [8] which is the random sample and hold LFO. And, we will adjust the shape control (mod knob A) to 0.25 which will distort the waveform a bit: