diff options
Diffstat (limited to 'src/tests/test_variable_tempo.cc')
| -rw-r--r-- | src/tests/test_variable_tempo.cc | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/tests/test_variable_tempo.cc b/src/tests/test_variable_tempo.cc index cd83a06..bbc9ebf 100644 --- a/src/tests/test_variable_tempo.cc +++ b/src/tests/test_variable_tempo.cc @@ -32,8 +32,8 @@ static void simulate_tempo(AudioEngine& engine, float& music_time, // Helper: Simulate tempo with variable scaling function static void simulate_tempo_fn(AudioEngine& engine, float& music_time, - float& physical_time, float duration, float dt, - float (*tempo_fn)(float)) { + float& physical_time, float duration, float dt, + float (*tempo_fn)(float)) { const int steps = (int)(duration / dt); for (int i = 0; i < steps; ++i) { physical_time += dt; @@ -96,9 +96,7 @@ void test_2x_speedup_reset_trick() { // Phase 1: Accelerate from 1.0x to 2.0x over 5 seconds printf(" Phase 1: Accelerating 1.0x → 2.0x\n"); - auto accel_fn = [](float t) { - return fminf(1.0f + (t / 5.0f), 2.0f); - }; + auto accel_fn = [](float t) { return fminf(1.0f + (t / 5.0f), 2.0f); }; simulate_tempo_fn(engine, music_time, physical_time, 5.0f, dt, accel_fn); const float tempo_scale = accel_fn(physical_time); @@ -133,9 +131,7 @@ void test_2x_slowdown_reset_trick() { // Phase 1: Decelerate from 1.0x to 0.5x over 5 seconds printf(" Phase 1: Decelerating 1.0x → 0.5x\n"); - auto decel_fn = [](float t) { - return fmaxf(1.0f - (t / 10.0f), 0.5f); - }; + auto decel_fn = [](float t) { return fmaxf(1.0f - (t / 10.0f), 0.5f); }; simulate_tempo_fn(engine, music_time, physical_time, 5.0f, dt, decel_fn); const float tempo_scale = decel_fn(physical_time); @@ -209,8 +205,9 @@ void test_continuous_acceleration() { auto accel_fn = [min_tempo, max_tempo](float t) { const float progress = t / 10.0f; - return fmaxf(min_tempo, fminf(max_tempo, - min_tempo + progress * (max_tempo - min_tempo))); + return fmaxf( + min_tempo, + fminf(max_tempo, min_tempo + progress * (max_tempo - min_tempo))); }; const int steps = (int)(10.0f / dt); @@ -252,9 +249,7 @@ void test_oscillating_tempo() { printf(" Oscillating tempo: 0.8x ↔ 1.2x\n"); - auto oscil_fn = [](float t) { - return 1.0f + 0.2f * sinf(t * 2.0f); - }; + auto oscil_fn = [](float t) { return 1.0f + 0.2f * sinf(t * 2.0f); }; const int steps = 100; for (int i = 0; i < steps; ++i) { |
