Inv.hpp (1541B)
1 #pragma once 2 3 #include "bogaudio.hpp" 4 5 extern Model* modelInv; 6 7 namespace bogaudio { 8 9 struct Inv : BGModule { 10 enum ParamsIds { 11 GATE1_PARAM, 12 LATCH1_PARAM, 13 GATE2_PARAM, 14 LATCH2_PARAM, 15 NUM_PARAMS 16 }; 17 18 enum InputsIds { 19 GATE1_INPUT, 20 IN1_INPUT, 21 GATE2_INPUT, 22 IN2_INPUT, 23 NUM_INPUTS 24 }; 25 26 enum OutputsIds { 27 OUT1_OUTPUT, 28 OUT2_OUTPUT, 29 NUM_OUTPUTS 30 }; 31 32 enum LightsIds { 33 LOW1_LIGHT, 34 HIGH1_LIGHT, 35 LOW2_LIGHT, 36 HIGH2_LIGHT, 37 NUM_LIGHTS 38 }; 39 40 bool _saveLatchedToPatch = false; 41 Trigger _trigger[2][maxChannels]; 42 bool _latch[2] {}; 43 bool _latchedHigh[2][maxChannels] {{},{}}; 44 45 Inv() { 46 config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); 47 configParam(GATE1_PARAM, 0.0f, 1.0f, 0.0f, "Channel 1 gate"); 48 configSwitch(LATCH1_PARAM, 0.0f, 1.0f, 0.0f, "Channel 1 latch", {"Disabled", "Enabled"}); 49 configParam(GATE2_PARAM, 0.0f, 1.0f, 0.0f, "Channel 2 gate"); 50 configSwitch(LATCH2_PARAM, 0.0f, 1.0f, 0.0f, "Channle 2 latch", {"Disabled", "Enabled"}); 51 configBypass(IN1_INPUT, OUT1_OUTPUT); 52 configBypass(IN2_INPUT, OUT2_OUTPUT); 53 54 configInput(GATE1_INPUT, "Gate 1"); 55 configInput(IN1_INPUT, "Signal 1"); 56 configInput(GATE2_INPUT, "Gate 2"); 57 configInput(IN2_INPUT, "Signal 2"); 58 59 configOutput(OUT1_OUTPUT, "Signal 1"); 60 configOutput(OUT2_OUTPUT, "Signal 2"); 61 } 62 63 void reset() override; 64 json_t* saveToJson(json_t* root) override; 65 void loadFromJson(json_t* root) override; 66 void modulate() override; 67 void processAll(const ProcessArgs& args) override; 68 void processDual(int i); 69 }; 70 71 } // namespace bogaudio