| @@ -44,6 +44,7 @@ struct SEQ3 : Module { | |||||
| }; | }; | ||||
| bool running = true; | bool running = true; | ||||
| bool clockPassthrough = false; | |||||
| dsp::BooleanTrigger runButtonTrigger; | dsp::BooleanTrigger runButtonTrigger; | ||||
| dsp::BooleanTrigger resetButtonTrigger; | dsp::BooleanTrigger resetButtonTrigger; | ||||
| @@ -107,6 +108,7 @@ struct SEQ3 : Module { | |||||
| } | } | ||||
| void onReset() override { | void onReset() override { | ||||
| clockPassthrough = false; | |||||
| for (int i = 0; i < 8; i++) { | for (int i = 0; i < 8; i++) { | ||||
| gates[i] = true; | gates[i] = true; | ||||
| } | } | ||||
| @@ -164,6 +166,7 @@ struct SEQ3 : Module { | |||||
| // Clock | // Clock | ||||
| bool clock = false; | bool clock = false; | ||||
| bool clockGate = false; | |||||
| if (running) { | if (running) { | ||||
| if (inputs[CLOCK_INPUT].isConnected()) { | if (inputs[CLOCK_INPUT].isConnected()) { | ||||
| // External clock | // External clock | ||||
| @@ -171,6 +174,7 @@ struct SEQ3 : Module { | |||||
| if (clockTrigger.process(inputs[CLOCK_INPUT].getVoltage(), 0.1f, 2.f) && !resetGate) { | if (clockTrigger.process(inputs[CLOCK_INPUT].getVoltage(), 0.1f, 2.f) && !resetGate) { | ||||
| clock = true; | clock = true; | ||||
| } | } | ||||
| clockGate = clockTrigger.isHigh(); | |||||
| } | } | ||||
| else { | else { | ||||
| // Internal clock | // Internal clock | ||||
| @@ -181,6 +185,7 @@ struct SEQ3 : Module { | |||||
| clock = true; | clock = true; | ||||
| } | } | ||||
| phase -= std::trunc(phase); | phase -= std::trunc(phase); | ||||
| clockGate = (phase < 0.5f); | |||||
| } | } | ||||
| } | } | ||||
| @@ -195,7 +200,9 @@ struct SEQ3 : Module { | |||||
| if (index >= numSteps) | if (index >= numSteps) | ||||
| index = 0; | index = 0; | ||||
| } | } | ||||
| bool clockGate = clockPulse.process(args.sampleTime); | |||||
| // Unless we're passing the clock gate, generate a pulse | |||||
| if (!clockPassthrough) | |||||
| clockGate = clockPulse.process(args.sampleTime); | |||||
| // Gate buttons | // Gate buttons | ||||
| for (int i = 0; i < 8; i++) { | for (int i = 0; i < 8; i++) { | ||||
| @@ -240,6 +247,9 @@ struct SEQ3 : Module { | |||||
| } | } | ||||
| json_object_set_new(rootJ, "gates", gatesJ); | json_object_set_new(rootJ, "gates", gatesJ); | ||||
| // clockPassthrough | |||||
| json_object_set_new(rootJ, "clockPassthrough", json_boolean(clockPassthrough)); | |||||
| return rootJ; | return rootJ; | ||||
| } | } | ||||
| @@ -258,6 +268,13 @@ struct SEQ3 : Module { | |||||
| gates[i] = !!json_integer_value(gateJ); | gates[i] = !!json_integer_value(gateJ); | ||||
| } | } | ||||
| } | } | ||||
| // clockPassthrough | |||||
| json_t* clockPassthroughJ = json_object_get(rootJ, "clockPassthrough"); | |||||
| if (clockPassthroughJ) | |||||
| clockPassthrough = json_is_true(clockPassthroughJ); | |||||
| else | |||||
| clockPassthrough = true; | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -357,6 +374,10 @@ struct SEQ3Widget : ModuleWidget { | |||||
| menu->addChild(new MenuSeparator); | menu->addChild(new MenuSeparator); | ||||
| menu->addChild(createBoolPtrMenuItem("Clock passthrough", "", &module->clockPassthrough)); | |||||
| menu->addChild(new MenuSeparator); | |||||
| menu->addChild(createMenuItem("Rotate left", "", | menu->addChild(createMenuItem("Rotate left", "", | ||||
| [=]() {module->rotateStates(-1);} | [=]() {module->rotateStates(-1);} | ||||
| )); | )); | ||||