diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/main.cc b/src/main.cc index a4cc67d..fdf9206 100644 --- a/src/main.cc +++ b/src/main.cc @@ -223,6 +223,7 @@ int main(int argc, char** argv) { // Get demo duration from sequence file (or -1 if not specified) const float demo_duration = GetDemoDuration(); + static double last_frame_time = 0.0; while (!platform_should_close(&platform_state)) { platform_poll(&platform_state); @@ -235,6 +236,7 @@ int main(int argc, char** argv) { // Graphics frame time - derived from platform's clock const double current_physical_time = platform_state.time + seek_time; + const double graphics_frame_time = current_physical_time - last_frame_time; // Audio playback time - master clock for audio events const float current_audio_time = audio_get_playback_time(); // Delta time for audio processing, based on audio clock @@ -270,20 +272,14 @@ int main(int argc, char** argv) { // Use graphics time for the print interval to avoid excessive output if audio clock is slow static float last_graphics_print_time = -1.0f; if (current_physical_time - last_graphics_print_time >= 0.5f) { // Print every 0.5 seconds - if (tempo_test_enabled) { - printf( - "[GraphicsT=%.2f, AudioT=%.2f, MusicT=%.2f, Beat=%d, Frac=%.2f, Peak=%.2f, Tempo=%.2fx]\n", - current_physical_time, current_audio_time, g_music_time, beat_number, beat, - visual_peak, g_tempo_scale); - } else { printf("[GraphicsT=%.2f, AudioT=%.2f, Beat=%d, Frac=%.2f, Peak=%.2f]\n", current_physical_time, current_audio_time, beat_number, beat, visual_peak); - } last_graphics_print_time = current_physical_time; } // Draw graphics using the graphics frame time and synchronized audio events - gpu_draw(visual_peak, aspect_ratio, graphics_frame_time, beat); + gpu_draw(visual_peak, aspect_ratio, (float)current_physical_time, beat); + last_frame_time = current_physical_time; // Update audio systems (tracker, synth, etc.) based on audio time progression audio_update(); |
