diff --git a/oscillator.cpp b/oscillator.cpp index b0475b7..bc87bf4 100644 --- a/oscillator.cpp +++ b/oscillator.cpp @@ -5,6 +5,6 @@ Oscillator::Oscillator() { phase = 0; phaseStep = (440 * 2 * M_PI) / 44100; value = 0; - flutterSpread = 0.005; - flutter = 0; + driftAmount = 0.005; + driftValue = 0; } \ No newline at end of file diff --git a/oscillator.h b/oscillator.h index 2e88134..31d082e 100644 --- a/oscillator.h +++ b/oscillator.h @@ -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; }