Switch.hpp (1539B)
1 #pragma once 2 3 #include "bogaudio.hpp" 4 #include "save_latch_to_patch.hpp" 5 6 extern Model* modelSwitch; 7 8 namespace bogaudio { 9 10 struct Switch : SaveLatchToPatchModule { 11 enum ParamsIds { 12 GATE_PARAM, 13 LATCH_PARAM, 14 NUM_PARAMS 15 }; 16 17 enum InputsIds { 18 GATE_INPUT, 19 HIGH1_INPUT, 20 LOW1_INPUT, 21 HIGH2_INPUT, 22 LOW2_INPUT, 23 NUM_INPUTS 24 }; 25 26 enum OutputsIds { 27 OUT1_OUTPUT, 28 OUT2_OUTPUT, 29 NUM_OUTPUTS 30 }; 31 32 enum LightsIds { 33 HIGH1_LIGHT, 34 LOW1_LIGHT, 35 HIGH2_LIGHT, 36 LOW2_LIGHT, 37 NUM_LIGHTS 38 }; 39 40 Trigger _trigger[maxChannels]; 41 int _high1LightSum = 0; 42 int _low1LightSum = 0; 43 int _high2LightSum = 0; 44 int _low2LightSum = 0; 45 46 Switch() { 47 config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); 48 configButton(GATE_PARAM, "Gate"); 49 configSwitch(LATCH_PARAM, 0.0f, 1.0f, 0.0f, "Latch", {"Disabled", "Enabled"}); 50 configBypass(LOW1_INPUT, OUT1_OUTPUT); 51 configBypass(LOW2_INPUT, OUT2_OUTPUT); 52 53 configInput(GATE_INPUT, "Gate"); 54 configInput(HIGH1_INPUT, "High 1 signal"); 55 configInput(LOW1_INPUT, "Low 1 signal"); 56 configInput(HIGH2_INPUT, "Hight 2 signal"); 57 configInput(LOW2_INPUT, "Low 2 signal"); 58 59 configOutput(OUT1_OUTPUT, "Signal 1"); 60 configOutput(OUT2_OUTPUT, "Signal 2"); 61 } 62 63 void reset() override; 64 int channels() override; 65 void channelsChanged(int before, int after) override; 66 void modulate() override; 67 void processAlways(const ProcessArgs& args) override; 68 void processChannel(const ProcessArgs& args, int _c) override; 69 void postProcessAlways(const ProcessArgs& args) override; 70 }; 71 72 } // namespace bogaudio