Browse Source

Logic: Process lights every 32 samples.

tags/v2.3.0
Andrew Belt 3 years ago
parent
commit
5bf8024865
1 changed files with 10 additions and 4 deletions
  1. +10
    -4
      src/Logic.cpp

+ 10
- 4
src/Logic.cpp View File

@@ -35,6 +35,8 @@ struct Logic : Module {
LIGHTS_LEN LIGHTS_LEN
}; };


dsp::ClockDivider lightDivider;

Logic() { Logic() {
config(PARAMS_LEN, INPUTS_LEN, OUTPUTS_LEN, LIGHTS_LEN); config(PARAMS_LEN, INPUTS_LEN, OUTPUTS_LEN, LIGHTS_LEN);
configButton(B_PARAM, "B"); configButton(B_PARAM, "B");
@@ -48,6 +50,8 @@ struct Logic : Module {
configOutput(NAND_OUTPUT, "NAND"); configOutput(NAND_OUTPUT, "NAND");
configOutput(XOR_OUTPUT, "XOR"); configOutput(XOR_OUTPUT, "XOR");
configOutput(XNOR_OUTPUT, "XNOR"); configOutput(XNOR_OUTPUT, "XNOR");

lightDivider.setDivision(32);
} }


void process(const ProcessArgs& args) override { void process(const ProcessArgs& args) override {
@@ -83,10 +87,12 @@ struct Logic : Module {
} }


// Set lights // Set lights
lights[B_BUTTON_LIGHT].setBrightness(bPush);
for (int i = 0; i < 8; i++) {
lights[NOTA_LIGHT + 2 * i + 0].setBrightness(anyState[i] && channels == 1);
lights[NOTA_LIGHT + 2 * i + 1].setBrightness(anyState[i] && channels > 1);
if (lightDivider.process()) {
lights[B_BUTTON_LIGHT].setBrightness(bPush);
for (int i = 0; i < 8; i++) {
lights[NOTA_LIGHT + 2 * i + 0].setBrightness(anyState[i] && channels == 1);
lights[NOTA_LIGHT + 2 * i + 1].setBrightness(anyState[i] && channels > 1);
}
} }
} }
}; };


Loading…
Cancel
Save