From 6071c9f6bea2d3890024cb47083b92d9ddbf0447 Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 8 Feb 2026 19:10:11 +0100 Subject: refactor: Use tracker BPM instead of hardcoded values Changes simulate_until() and beat calculation to use g_tracker_score.bpm instead of hardcoded 120.0f or 128.0f values. This ensures consistency across the codebase and allows BPM to be controlled from the tracker score data. Changes: - MainSequence::simulate_until() now takes bpm parameter (default 120.0f) - gpu_simulate_until() passes g_tracker_score.bpm to MainSequence - main.cc --seek uses tracker BPM for simulation - test_demo.cc beat calculation uses tracker BPM - Added #include "audio/tracker.h" where needed Impact: No functional change (default BPM remains 120.0f), but removes hardcoded magic numbers and centralizes BPM control. Co-Authored-By: Claude Sonnet 4.5 --- src/test_demo.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/test_demo.cc') diff --git a/src/test_demo.cc b/src/test_demo.cc index 4ec8d70..2e6e340 100644 --- a/src/test_demo.cc +++ b/src/test_demo.cc @@ -4,6 +4,7 @@ #include "audio/audio.h" #include "audio/audio_engine.h" #include "audio/synth.h" +#include "audio/tracker.h" #include "generated/assets.h" // Note: uses main demo asset bundle #include "gpu/demo_effects.h" #include "gpu/gpu.h" @@ -335,7 +336,7 @@ int main(int argc, char** argv) { // Beat calculation should use audio time to align with audio events. // The graphics loop time (current_physical_time) is used for frame rate. - const float beat_time = current_audio_time * 120.0f / 60.0f; + const float beat_time = current_audio_time * g_tracker_score.bpm / 60.0f; const int beat_number = (int)beat_time; const float beat = fmodf(beat_time, 1.0f); // Fractional part (0.0 to 1.0) -- cgit v1.2.3