Rename "flutter" to "drift"

main
Thor 1 year ago
parent 740c317707
commit b2d71ba9a4
  1. 4
      oscillator.cpp
  2. 15
      oscillator.h

@ -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;
}

@ -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;
}

Loading…
Cancel
Save