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)
| 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) |
| 196 | float 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 |