From 93f9fa15a7bb6a5f29d82fe7037aa0dfa7c88b55 Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 8 Feb 2026 11:44:45 +0100 Subject: chore: Clean up generated files and update project config - Remove src/generated/ directory to avoid committing generated code. - Update .gitignore to exclude src/generated/. - Stage modifications made to audio tracker, main, and test demo files. --- src/main.cc | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/main.cc') diff --git a/src/main.cc b/src/main.cc index fdf9206..95582e8 100644 --- a/src/main.cc +++ b/src/main.cc @@ -175,7 +175,7 @@ int main(int argc, char** argv) { const float demo_duration = GetDemoDuration(); const float max_duration = (demo_duration > 0.0f) ? demo_duration : 60.0f; - const float update_dt = 1.0f / 60.0f; // 60Hz update rate + const float update_dt = 1.0f / 60.0f; // 60Hz update rate const int frames_per_update = (int)(32000 * update_dt); // ~533 frames const int samples_per_update = frames_per_update * 2; // Stereo @@ -246,16 +246,18 @@ int main(int argc, char** argv) { // Auto-exit when demo finishes (if duration is specified) if (demo_duration > 0.0f && current_physical_time >= demo_duration) { #if !defined(STRIP_ALL) - printf("Demo finished at %.2f seconds. Exiting...\n", current_physical_time); + printf("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 @@ -269,11 +271,14 @@ int main(int argc, char** argv) { const float beat = fmodf(beat_time, 1.0f); // Fractional part (0.0 to 1.0) // Print beat/time info periodically for identifying sync points - // Use graphics time for the print interval to avoid excessive output if audio clock is slow + // 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 - printf("[GraphicsT=%.2f, AudioT=%.2f, Beat=%d, Frac=%.2f, Peak=%.2f]\n", - current_physical_time, current_audio_time, beat_number, beat, visual_peak); + if (current_physical_time - last_graphics_print_time >= + 0.5f) { // Print every 0.5 seconds + 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; } @@ -281,7 +286,8 @@ int main(int argc, char** argv) { 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 + // Update audio systems (tracker, synth, etc.) based on audio time + // progression audio_update(); } -- cgit v1.2.3