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

Function calculateAverage

tests/fl/audio/spectral_equalizer.hpp:11–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9namespace {
10
11static float calculateAverage(span<const float> bins) {
12 if (bins.size() == 0) {
13 return 0.0f;
14 }
15
16 float sum = 0.0f;
17 for (size i = 0; i < bins.size(); ++i) {
18 sum += bins[i];
19 }
20 return sum / static_cast<float>(bins.size());
21}
22
23} // anonymous namespace
24

Callers 1

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected