When I released this object, i planned to make some sort of tutorial but time flies...
So, it is a nice occasion to start one (and to work again on its XT / cross table extension).
I will focus on the functions that can be used for the classic waveforms found in DX/TX synths.
The waveform stored in the gen object are calculated and preprocessed for anti aliasing at initialization of the patch. Once calculated they are "static", hence a gain in CPU.
The syntax is C code.
In fact, it is a line of C code that is inserted in the object in its init procedure.
x is the float variable that varies from 0 to 1.
The function sin1(x) is a sine that makes a cycle when x goes from 0 to 1 (so you don't need to bother with pi coefficients).
sin1(x) // generates a one cycle sine wave
sin1(0.5f * x) // generates half a sine wave
sin1(0.25f * x) // generates a quarter sine wave
sin1(x)+0.5f*sin1(7*x) // generates two harmonics (one and seven)
tri(x) is a triangle function, it can be provided with a secondary parameter that sets its symmetry.
It can be used the same way as the sin1(x) function.
tri(x, 0.333f) + 0.5f * tri(7*x)
A very useful trick is the C ternary operator
condition ? value for true : value for false
conditionnal ternary operator on wikipedia
Thanks to it, it is possible to set one portion of the waveform with a formula and an other portion with another.
x<0.5f ? sin1(2*x) : tri(2*x,0.3333f)