| 68 | } |
| 69 | |
| 70 | void process(const ProcessArgs& args) override { |
| 71 | const int numPolyphonyEngines = std::max({1, |
| 72 | inputs[A1_INPUT].getChannels(), inputs[B1_INPUT].getChannels(), inputs[C1_INPUT].getChannels(), |
| 73 | inputs[A2_INPUT].getChannels(), inputs[B2_INPUT].getChannels(), inputs[C2_INPUT].getChannels()}); |
| 74 | |
| 75 | for (int c = 0; c < numPolyphonyEngines; c += 4) { |
| 76 | const float_4 inA1 = inputs[A1_INPUT].getPolyVoltageSimd<float_4>(c); |
| 77 | const float_4 inB1 = inputs[B1_INPUT].getNormalPolyVoltageSimd<float_4>(5.f, c) / 5.f; |
| 78 | const float_4 inC1 = inputs[C1_INPUT].getNormalPolyVoltageSimd<float_4>(5.f, c); |
| 79 | |
| 80 | const float gainB1 = params[B1_PARAM].getValue() * gains[(int) params[GAIN_B1_PARAM].getValue()]; |
| 81 | const float gainC1 = params[C1_PARAM].getValue() * gains[(int) params[GAIN_C1_PARAM].getValue()]; |
| 82 | |
| 83 | // ch1: a * b + c |
| 84 | const float_4 out1 = inA1 * gainB1 * inB1 + gainC1 * inC1; |
| 85 | |
| 86 | const float_4 inA2 = inputs[A2_INPUT].getNormalPolyVoltageSimd<float_4>(inA1 * params[MODE_PARAM].getValue(), c); |
| 87 | const float_4 inB2 = inputs[B2_INPUT].getNormalPolyVoltageSimd<float_4>(5.f, c) / 5.f; |
| 88 | const float_4 inC2 = inputs[C2_INPUT].getNormalPolyVoltageSimd<float_4>(5.f, c); |
| 89 | |
| 90 | const float gainB2 = params[B2_PARAM].getValue() * gains[(int) params[GAIN_B2_PARAM].getValue()]; |
| 91 | const float gainC2 = params[C2_PARAM].getValue() * gains[(int) params[GAIN_C2_PARAM].getValue()]; |
| 92 | |
| 93 | // ch2: a * b + c |
| 94 | const float_4 out2 = inA2 * gainB2 * inB2 + gainC2 * inC2; |
| 95 | // if we're in mix mode and out1 is not connected, mix ch1 into ch2 |
| 96 | const bool isCh1MixedIntoCh2 = (params[MODE_PARAM].getValue() == 0.f) && !outputs[OUT_1_OUTPUT].isConnected(); |
| 97 | |
| 98 | if (applyClipping) { |
| 99 | outputs[OUT_1_OUTPUT].setVoltageSimd(clip(out1), c); |
| 100 | outputs[OUT_2_OUTPUT].setVoltageSimd(clip(out1 * isCh1MixedIntoCh2 + out2), c); |
| 101 | } |
| 102 | else { |
| 103 | outputs[OUT_1_OUTPUT].setVoltageSimd(out1, c); |
| 104 | outputs[OUT_2_OUTPUT].setVoltageSimd(out1 * isCh1MixedIntoCh2 + out2, c); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | outputs[OUT_1_OUTPUT].setChannels(numPolyphonyEngines); |
| 109 | outputs[OUT_2_OUTPUT].setChannels(numPolyphonyEngines); |
| 110 | |
| 111 | if (lightDivider.process()) { |
| 112 | const float lightTime = args.sampleTime * lightDivider.getDivision(); |
| 113 | processLEDs(lightTime, numPolyphonyEngines); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | void processLEDs(const float lightTime, const int channels) { |
| 118 |
nothing calls this directly
no test coverage detected