| 207 | } |
| 208 | |
| 209 | void processLEDs(const float_4* output, const float sampleTime) { |
| 210 | |
| 211 | const int maxPolyphony = outputs[MIX_OUTPUT].getChannels(); |
| 212 | |
| 213 | if (maxPolyphony == 1) { |
| 214 | const float rmsOut = std::fabs(output[0][0]); |
| 215 | lights[MIX_LIGHT + 0].setBrightness(0.f); |
| 216 | lights[MIX_LIGHT + 1].setBrightnessSmooth(rmsOut / 5.f, sampleTime); |
| 217 | lights[MIX_LIGHT + 2].setBrightness(0.f); |
| 218 | |
| 219 | if (rmsOut > 10.f) { |
| 220 | clipTimer = clipTime; |
| 221 | } |
| 222 | |
| 223 | const bool clip = clipTimer > 0.f; |
| 224 | if (clip) { |
| 225 | clipTimer -= sampleTime; |
| 226 | } |
| 227 | |
| 228 | lights[MIX_CLIP_LIGHT + 0].setBrightnessSmooth(clip, sampleTime); |
| 229 | lights[MIX_CLIP_LIGHT + 1].setBrightness(0.f); |
| 230 | lights[MIX_CLIP_LIGHT + 2].setBrightness(0.f); |
| 231 | } |
| 232 | else { |
| 233 | |
| 234 | float maxRmsOut = 0.f; |
| 235 | for (int c = 0; c < maxPolyphony; c++) { |
| 236 | maxRmsOut = std::max(maxRmsOut, std::fabs(output[c / 4][c % 4])); |
| 237 | } |
| 238 | |
| 239 | lights[MIX_LIGHT + 0].setBrightness(0.f); |
| 240 | lights[MIX_LIGHT + 1].setBrightness(0.f); |
| 241 | lights[MIX_LIGHT + 2].setBrightnessSmooth(maxRmsOut / 5.f, sampleTime); |
| 242 | |
| 243 | // if any channel peaks above 10V, turn the clip light on for the next clipTime seconds |
| 244 | if (maxRmsOut > 10.f) { |
| 245 | clipTimer = clipTime; |
| 246 | } |
| 247 | |
| 248 | const bool clip = clipTimer > 0.f; |
| 249 | if (clip) { |
| 250 | clipTimer -= sampleTime; |
| 251 | } |
| 252 | lights[MIX_CLIP_LIGHT + 0].setBrightnessSmooth(clip, sampleTime); |
| 253 | lights[MIX_CLIP_LIGHT + 1].setBrightness(0.f); |
| 254 | lights[MIX_CLIP_LIGHT + 2].setBrightness(0.f); |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | void dataFromJson(json_t* rootJ) override { |
| 259 | json_t* applySaturationJ = json_object_get(rootJ, "applySaturation"); |
nothing calls this directly
no test coverage detected