commit 14ee1e2573dbda2b22edf9c44b82ef9a1f82ea1b
parent 101deccadf1aec5fe2a7bb2a8e7a2388384d7ce5
Author: Matt Demanett <matt@demanett.net>
Date: Sat, 16 Mar 2019 22:15:10 -0400
LLFO: fix so that wave indicator updates when wave is changed when no output is patched. #39
Diffstat:
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/LLFO.cpp b/src/LLFO.cpp
@@ -15,12 +15,13 @@ void LLFO::onSampleRateChange() {
void LLFO::step() {
lights[SLOW_LIGHT].value = _slowMode = params[SLOW_PARAM].value > 0.5f;
- lights[SINE_LIGHT].value = _wave == SINE_WAVE;
- lights[TRIANGLE_LIGHT].value = _wave == TRIANGLE_WAVE;
- lights[RAMP_UP_LIGHT].value = _wave == RAMP_UP_WAVE;
- lights[RAMP_DOWN_LIGHT].value = _wave == RAMP_DOWN_WAVE;
- lights[SQUARE_LIGHT].value = _wave == SQUARE_WAVE;
- lights[PULSE_LIGHT].value = _wave == PULSE_WAVE;
+ Wave wave = (Wave)params[WAVE_PARAM].value;
+ lights[SINE_LIGHT].value = wave == SINE_WAVE;
+ lights[TRIANGLE_LIGHT].value = wave == TRIANGLE_WAVE;
+ lights[RAMP_UP_LIGHT].value = wave == RAMP_UP_WAVE;
+ lights[RAMP_DOWN_LIGHT].value = wave == RAMP_DOWN_WAVE;
+ lights[SQUARE_LIGHT].value = wave == SQUARE_WAVE;
+ lights[PULSE_LIGHT].value = wave == PULSE_WAVE;
if (!outputs[OUT_OUTPUT].active) {
return;
}
@@ -45,9 +46,8 @@ void LLFO::step() {
}
_phasor.setFrequency(frequency);
- _wave = (Wave)params[WAVE_PARAM].value;
_invert = false;
- switch (_wave) {
+ switch (wave) {
case SINE_WAVE: {
_oscillator = &_sine;
break;
diff --git a/src/LLFO.hpp b/src/LLFO.hpp
@@ -66,13 +66,11 @@ struct LLFO : Module {
SawOscillator _ramp;
SquareOscillator _square;
- Wave _wave;
bool _invert;
Phasor* _oscillator;
LLFO()
: Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS)
- , _wave(SINE_WAVE)
, _invert(false)
, _oscillator(&_sine)
{