diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-08 11:39:08 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-08 11:39:08 +0100 |
| commit | d84061a938ad71e48c862133d9bea8c1d38a0d1a (patch) | |
| tree | bbd2847074cc892eb22721d0582f7818dc4b4b28 /src | |
| parent | 106752fdb0b5d0a0d5362c1084ec431a8df41f59 (diff) | |
fix(demo64k): Pass absolute time to gpu_draw and remove tempo_test_enabled from main.cc
This commit resolves a bug where effects in demo64k were not showing due to receiving delta time instead of absolute time. The parameter to is now correctly set to . Additionally, and its associated conditional block, which are specific to , have been removed from to streamline the main application logic.
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(); |
