SynthLab SDK
|
This is a simple modulo counter whose mcounter member stores the value of the modulo counter as a unipolar ramp waveform and documented in the synth book. It is already setup for standalone operation because it does not require any members that are shared resources. You can easily create a primitive sawtooth waveform with it using the following code example:
Notice the final line of code that advances and wraps the modulo counter. When you are working with one-shot oscillators that only play once through the oscillator waveform, PCM sample, or wavetable, you may use the wrapping flag to know when the counter has wrapped across the 1.0 boundary to stop the output. In this case you use two separate functions and generally you will use them in this order, checking the wrap at the top of the render() function, and advancing it at the end.