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

Method calculateTrebleTrend

src/fl/audio/detector/buildup.cpp.hpp:184–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184float BuildupDetector::calculateTrebleTrend() const {
185 if (mTrebleHistorySize < 4 || !mTrebleSG.full()) {
186 return 0.0f; // Not enough data
187 }
188
189 // Use SG-smoothed current value vs oldest history entry for trend
190 float currentSmoothed = mTrebleSG.value();
191 int oldestIdx = (mTrebleHistorySize < 16) ? 0 : mTrebleHistoryIndex;
192 float oldestValue = mTrebleHistory[oldestIdx];
193
194 if (oldestValue < 1e-6f) {
195 return 0.0f;
196 }
197
198 float riseRate = (currentSmoothed - oldestValue) / oldestValue;
199 return fl::max(0.0f, fl::min(2.0f, riseRate)); // Clamp to [0, 2]
200}
201
202float BuildupDetector::calculateBuildupIntensity(float energyTrend, float trebleTrend, float rms) const {
203 // Buildup intensity is a combination of:

Callers

nothing calls this directly

Calls 3

maxFunction · 0.85
fullMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected