| 2 | |
| 3 | |
| 4 | struct Links : Module { |
| 5 | enum ParamIds { |
| 6 | NUM_PARAMS |
| 7 | }; |
| 8 | enum InputIds { |
| 9 | A1_INPUT, |
| 10 | B1_INPUT, |
| 11 | B2_INPUT, |
| 12 | C1_INPUT, |
| 13 | C2_INPUT, |
| 14 | C3_INPUT, |
| 15 | NUM_INPUTS |
| 16 | }; |
| 17 | enum OutputIds { |
| 18 | A1_OUTPUT, |
| 19 | A2_OUTPUT, |
| 20 | A3_OUTPUT, |
| 21 | B1_OUTPUT, |
| 22 | B2_OUTPUT, |
| 23 | C1_OUTPUT, |
| 24 | NUM_OUTPUTS |
| 25 | }; |
| 26 | enum LightIds { |
| 27 | ENUMS(A_LIGHT, 2), |
| 28 | ENUMS(B_LIGHT, 2), |
| 29 | ENUMS(C_LIGHT, 2), |
| 30 | NUM_LIGHTS |
| 31 | }; |
| 32 | |
| 33 | Links() { |
| 34 | config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); |
| 35 | } |
| 36 | |
| 37 | void process(const ProcessArgs& args) override { |
| 38 | // Section A |
| 39 | { |
| 40 | int channels = std::max(inputs[A1_INPUT].getChannels(), 1); |
| 41 | float in[16]; |
| 42 | for (int c = 0; c < channels; c++) { |
| 43 | in[c] = inputs[A1_INPUT].getVoltage(c); |
| 44 | outputs[A1_OUTPUT].setVoltage(in[c], c); |
| 45 | outputs[A2_OUTPUT].setVoltage(in[c], c); |
| 46 | outputs[A3_OUTPUT].setVoltage(in[c], c); |
| 47 | } |
| 48 | outputs[A1_OUTPUT].setChannels(channels); |
| 49 | outputs[A2_OUTPUT].setChannels(channels); |
| 50 | outputs[A3_OUTPUT].setChannels(channels); |
| 51 | lights[A_LIGHT + 0].setSmoothBrightness(in[0] / 5.f, args.sampleTime); |
| 52 | lights[A_LIGHT + 1].setSmoothBrightness(-in[0] / 5.f, args.sampleTime); |
| 53 | } |
| 54 | |
| 55 | // Section B |
| 56 | { |
| 57 | int channels = std::max(std::max(inputs[B1_INPUT].getChannels(), inputs[B2_INPUT].getChannels()), 1); |
| 58 | float in[16]; |
| 59 | for (int c = 0; c < channels; c++) { |
| 60 | in[c] = inputs[B1_INPUT].getPolyVoltage(c) + inputs[B2_INPUT].getPolyVoltage(c); |
| 61 | outputs[B1_OUTPUT].setVoltage(in[c], c); |
nothing calls this directly
no outgoing calls
no test coverage detected