summaryrefslogtreecommitdiff
path: root/src/test_demo.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/test_demo.cc')
-rw-r--r--src/test_demo.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/test_demo.cc b/src/test_demo.cc
index 656d0ba..91c5427 100644
--- a/src/test_demo.cc
+++ b/src/test_demo.cc
@@ -229,19 +229,18 @@ int main(int argc, char** argv) {
auto fill_audio_buffer = [&](float audio_dt, double physical_time) {
// Calculate tempo scale if --tempo flag enabled
if (tempo_test_enabled) {
- // Each bar = 2 seconds at 120 BPM (4 beats)
- const float bar_duration = 2.0f;
- // Use physical_time for tempo modulation progression
- const int bar_number = (int)(physical_time / bar_duration);
- const float bar_progress = fmodf((float)physical_time, bar_duration) /
- bar_duration; // 0.0-1.0 within bar
-
- if (bar_number % 2 == 0) {
- // Even bars: Ramp from 1.0x → 1.5x
- g_tempo_scale = 1.0f + (0.5f * bar_progress);
+ const float t = (float)physical_time;
+ if (t >= 2.0f && t < 4.0f) {
+ // [2s->4s]: Accelerate from 1.0x to 1.5x
+ const float progress = (t - 2.0f) / 2.0f;
+ g_tempo_scale = 1.0f + (0.5f * progress);
+ } else if (t >= 6.0f && t < 8.0f) {
+ // [6s->8s]: Decelerate from 1.0x to 0.66x
+ const float progress = (t - 6.0f) / 2.0f;
+ g_tempo_scale = 1.0f - (0.34f * progress);
} else {
- // Odd bars: Ramp from 1.0x → 0.66x
- g_tempo_scale = 1.0f - (0.34f * bar_progress);
+ // All other times: Normal tempo
+ g_tempo_scale = 1.0f;
}
} else {
g_tempo_scale = 1.0f; // No tempo variation