diff options
Diffstat (limited to 'src/test_demo.cc')
| -rw-r--r-- | src/test_demo.cc | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/test_demo.cc b/src/test_demo.cc index f3bda78..87cdd1e 100644 --- a/src/test_demo.cc +++ b/src/test_demo.cc @@ -231,9 +231,8 @@ int main(int argc, char** argv) { 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 + 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 @@ -273,10 +272,12 @@ int main(int argc, char** argv) { log_peaks_fine ? "fine (per-frame)" : "beat-aligned"); fprintf(peak_log, "// To plot with gnuplot:\n"); fprintf(peak_log, - "// gnuplot -p -e \"set xlabel 'Time (s)'; set ylabel 'Peak'; plot '%s' using 2:3 with lines title 'Raw Peak'\"\n", + "// gnuplot -p -e \"set xlabel 'Time (s)'; set ylabel 'Peak'; " + "plot '%s' using 2:3 with lines title 'Raw Peak'\"\n", log_peaks_file); if (log_peaks_fine) { - fprintf(peak_log, "// Columns: frame_number clock_time raw_peak beat_number\n"); + fprintf(peak_log, + "// Columns: frame_number clock_time raw_peak beat_number\n"); } else { fprintf(peak_log, "// Columns: beat_number clock_time raw_peak\n"); } @@ -313,16 +314,18 @@ int main(int argc, char** argv) { // Auto-exit at end (based on physical time for graphics loop consistency) if (demo_duration > 0.0f && current_physical_time >= demo_duration) { #if !defined(STRIP_ALL) - printf("test_demo finished at %.2f seconds. Exiting...\n", current_physical_time); + printf("test_demo finished at %.2f seconds. Exiting...\n", + current_physical_time); #endif break; } // This fill_audio_buffer call is crucial for audio system to process - // events based on the *current audio time* and *graphics physical time* context + // events based on the *current audio time* and *graphics physical time* + // context fill_audio_buffer(audio_dt, current_physical_time); - // --- Graphics Update --- + // --- Graphics Update --- const float aspect_ratio = platform_state.aspect_ratio; // Peak value derived from audio, but used for visual effect intensity @@ -347,7 +350,8 @@ int main(int argc, char** argv) { raw_peak, beat_number); } else if (beat_number != last_beat_logged) { // Log only at beat boundaries - fprintf(peak_log, "%d %.6f %.6f\n", beat_number, current_audio_time, raw_peak); + fprintf(peak_log, "%d %.6f %.6f\n", beat_number, current_audio_time, + raw_peak); last_beat_logged = beat_number; } } @@ -358,12 +362,14 @@ int main(int argc, char** argv) { if (current_physical_time - last_graphics_print_time >= 0.5f) { 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); + "[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); + current_physical_time, current_audio_time, beat_number, beat, + visual_peak); } last_graphics_print_time = current_physical_time; } @@ -373,7 +379,8 @@ int main(int argc, char** argv) { const float graphics_frame_time = (float)current_physical_time; gpu_draw(visual_peak, aspect_ratio, graphics_frame_time, beat); - // Update audio systems (tracker, synth, etc.) based on audio time progression + // Update audio systems (tracker, synth, etc.) based on audio time + // progression audio_update(); } |
