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

Method adjustRateToFPS

src/fl/audio/detector/vibe.cpp.hpp:196–203  ·  view source on GitHub ↗

FPS-independent rate adjustment: Converts a per-frame smoothing rate tuned at fps1 to the equivalent rate at actualFps, preserving the per-second behavior. At 30fps with rate=0.5: per-second retention = 0.5^30 ≈ 9.3e-10 At 60fps the per-frame rate adjusts to ~0.707 so 0.707^60 ≈ 9.3e-10 (same)

Source from the content-addressed store, hash-verified

194// At 30fps with rate=0.5: per-second retention = 0.5^30 ≈ 9.3e-10
195// At 60fps the per-frame rate adjusts to ~0.707 so 0.707^60 ≈ 9.3e-10 (same)
196float Vibe::adjustRateToFPS(float rateAtFps1, float fps1,
197 float actualFps) {
198 if (actualFps <= 0.0f) {
199 return rateAtFps1;
200 }
201 float perSecond = fl::powf(rateAtFps1, fps1);
202 return fl::powf(perSecond, 1.0f / actualFps);
203}
204
205} // namespace detector
206} // namespace audio

Callers

nothing calls this directly

Calls 1

powfFunction · 0.85

Tested by

no test coverage detected