|
|
|
@ -11,12 +11,11 @@ public: |
|
|
|
|
enum Mode { MODE_SINE, MODE_SAW, MODE_SQUARE }; |
|
|
|
|
|
|
|
|
|
Mode mode; |
|
|
|
|
float phase; // current waveform phase angle (radians)
|
|
|
|
|
float phaseStep; // phase angle step per sample
|
|
|
|
|
float value; // current amplitude value
|
|
|
|
|
float flutterSpread; |
|
|
|
|
float flutterSpeed; |
|
|
|
|
float flutter; |
|
|
|
|
float phase; // current waveform phase angle (radians)
|
|
|
|
|
float phaseStep; // phase angle step per sample
|
|
|
|
|
float value; // current amplitude value
|
|
|
|
|
float driftAmount; |
|
|
|
|
float driftValue; |
|
|
|
|
|
|
|
|
|
Oscillator(); |
|
|
|
|
|
|
|
|
@ -63,8 +62,8 @@ public: |
|
|
|
|
value -= polyBlep(fmod(t + 0.5, 1.0)); // Layer output of Poly BLEP on top (flop)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
flutter += 0.01 * ((float) rand() / RAND_MAX - 0.5) - 0.00001 * flutter; |
|
|
|
|
phase += phaseStep * (1.0 + flutterSpread * flutter); |
|
|
|
|
driftValue += 0.01 * ((float) rand() / RAND_MAX - 0.5) - 0.00001 * driftValue; |
|
|
|
|
phase += phaseStep * (1.0 + driftAmount * driftValue); |
|
|
|
|
if(phase >= PIx2) { // wrap if phase angle >=360º
|
|
|
|
|
phase -= PIx2; |
|
|
|
|
} |
|
|
|
|