Browse Source

Use ADSR lights for stage and env level

tags/v0.5.0
Andrew Belt 7 years ago
parent
commit
33ac90b2c5
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      src/ADSR.cpp

+ 6
- 6
src/ADSR.cpp View File

@@ -48,12 +48,6 @@ void ADSR::step() {
float sustain = clampf(params[SUSTAIN_PARAM].value + inputs[SUSTAIN_INPUT].value / 10.0, 0.0, 1.0); float sustain = clampf(params[SUSTAIN_PARAM].value + inputs[SUSTAIN_INPUT].value / 10.0, 0.0, 1.0);
float release = clampf(params[RELEASE_PARAM].value + inputs[RELEASE_PARAM].value / 10.0, 0.0, 1.0); float release = clampf(params[RELEASE_PARAM].value + inputs[RELEASE_PARAM].value / 10.0, 0.0, 1.0);


// Lights
lights[ATTACK_LIGHT].value = attack;
lights[DECAY_LIGHT].value = decay;
lights[SUSTAIN_LIGHT].value = sustain;
lights[RELEASE_LIGHT].value = release;

// Gate and trigger // Gate and trigger
bool gated = inputs[GATE_INPUT].value >= 1.0; bool gated = inputs[GATE_INPUT].value >= 1.0;
if (trigger.process(inputs[TRIG_INPUT].value)) if (trigger.process(inputs[TRIG_INPUT].value))
@@ -98,6 +92,12 @@ void ADSR::step() {
} }


outputs[ENVELOPE_OUTPUT].value = 10.0 * env; outputs[ENVELOPE_OUTPUT].value = 10.0 * env;

// Lights
lights[ATTACK_LIGHT].value = (gated && !decaying) ? 1.0 : 0.0;
lights[DECAY_LIGHT].value = (gated && decaying) ? 1.0 : 0.0;
lights[SUSTAIN_LIGHT].setBrightness(env);
lights[RELEASE_LIGHT].value = (!gated) ? 1.0 : 0.0;
} }






Loading…
Cancel
Save