| 56 | } |
| 57 | |
| 58 | void processSection(const ProcessArgs& args, int& lastChannels, float_4* lastOut, ParamIds levelB, ParamIds levelC, InputIds inputA, InputIds inputB, InputIds inputC, OutputIds output, LightIds outLight) { |
| 59 | // Compute polyphony channels |
| 60 | int channels = std::max(lastChannels, inputs[inputA].getChannels()); |
| 61 | channels = std::max(channels, inputs[inputB].getChannels()); |
| 62 | channels = std::max(channels, inputs[inputC].getChannels()); |
| 63 | lastChannels = channels; |
| 64 | |
| 65 | // Get param levels |
| 66 | float gainB = 2.f * exponentialBipolar80Pade_5_4(params[levelB].getValue()); |
| 67 | float gainC = exponentialBipolar80Pade_5_4(params[levelC].getValue()); |
| 68 | |
| 69 | for (int c = 0; c < channels; c += 4) { |
| 70 | // Get inputs |
| 71 | float_4 inA = inputs[inputA].getPolyVoltageSimd<float_4>(c); |
| 72 | float_4 inB = inputs[inputB].getNormalPolyVoltageSimd<float_4>(5.f, c) * gainB; |
| 73 | float_4 inC = inputs[inputC].getNormalPolyVoltageSimd<float_4>(10.f, c) * gainC; |
| 74 | |
| 75 | // Compute and set output |
| 76 | float_4 out = inA * inB / 5.f + inC; |
| 77 | lastOut[c / 4] += out; |
| 78 | if (outputs[output].isConnected()) { |
| 79 | outputs[output].setChannels(channels); |
| 80 | outputs[output].setVoltageSimd(clip(lastOut[c / 4]), c); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | // Set lights |
| 85 | if (channels == 1) { |
| 86 | float b = lastOut[0][0]; |
| 87 | lights[outLight + 0].setSmoothBrightness(b / 5.f, args.sampleTime); |
| 88 | lights[outLight + 1].setSmoothBrightness(-b / 5.f, args.sampleTime); |
| 89 | lights[outLight + 2].setBrightness(0.f); |
| 90 | } |
| 91 | else { |
| 92 | // RMS of output |
| 93 | float b = 0.f; |
| 94 | for (int c = 0; c < channels; c++) |
| 95 | b += std::pow(lastOut[c / 4][c % 4], 2); |
| 96 | b = std::sqrt(b / channels); |
| 97 | lights[outLight + 0].setBrightness(0.0f); |
| 98 | lights[outLight + 1].setBrightness(0.0f); |
| 99 | lights[outLight + 2].setBrightness(b / 5.f); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | void process(const ProcessArgs& args) override { |
| 104 | int channels = 1; |
nothing calls this directly
no test coverage detected