MCPcopy Create free account
hub / github.com/FastLED/FastLED / hasVariation

Function hasVariation

tests/fl/audio/synth.hpp:22–34  ·  view source on GitHub ↗

Helper to check if waveform has significant variation (not all zeros or constant)

Source from the content-addressed store, hash-verified

20
21// Helper to check if waveform has significant variation (not all zeros or constant)
22static bool hasVariation(const float* samples, int32_t count) {
23 if (count < 2) return false;
24
25 float minVal = samples[0];
26 float maxVal = samples[0];
27 for (int32_t i = 1; i < count; ++i) {
28 if (samples[i] < minVal) minVal = samples[i];
29 if (samples[i] > maxVal) maxVal = samples[i];
30 }
31
32 // Waveform should have at least some variation
33 return (maxVal - minVal) > 0.1f;
34}
35
36} // anonymous namespace
37

Callers 1

synth.hppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected