From 8c5e41724fdfc3be24e95f48ae4b2be616404074 Mon Sep 17 00:00:00 2001 From: skal Date: Thu, 26 Mar 2026 10:09:34 +0100 Subject: fix(audio): P1-P3 fixes from audio code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit P1 — correctness bugs: - tracker.cc: move delete[] loop before pool reset so guard condition is valid - audio_engine: replace tracker_reset() with tracker_init() in reset()/seek() so synth IDs are re-registered after synth_init() clears spectrogram slots - spectrogram_resource_manager: set spec.version in load_procedural() (was UB) P2 — minor bugs: - synth.cc: move pan clamp unconditionally before debug-only block - gen.cc: remove dead `freq` variable in generate_note_spectrogram() - tracker.cc: remove duplicate g_sample_synth_cache clear loop P3 — cleanup: - Replace hardcoded 32000.0f with RING_BUFFER_SAMPLE_RATE (5 sites) - audio.cc: extract clip_samples() helper, remove duplicated clip loops - audio_engine: inline update_silent(), remove no-op prewarm_for_time_range() - Remove stale comments: stdio.h include, NEW: labels, CACHING block, NOTE: - Move TODO(timing) drift notes from source to TODO.md handoff(Gemini): audio review implemented, 36/36 tests passing --- src/audio/synth.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/audio/synth.h') diff --git a/src/audio/synth.h b/src/audio/synth.h index e5a8197..d3bd70e 100644 --- a/src/audio/synth.h +++ b/src/audio/synth.h @@ -7,16 +7,6 @@ #include "dct.h" #include -// Based on tracker score analysis (see generated/music_data.cc) -// Max simultaneous patterns: 5, recommended: 10 each -// -// CACHING IMPLEMENTATION (COMPLETED): -// - All asset samples are registered ONCE in tracker_init() -// - All generated notes are cached by parameters (freq, duration, etc.) -// - Current track: 14 unique samples (8 assets + 6 generated notes) -// - With caching: MAX_SPECTROGRAMS = 32 provides 2.3x headroom -// -// Memory cost: 32 slots × 48 bytes = 1.5KB (down from 12KB with 256 slots) #define MAX_VOICES 48 // Per tracker_compiler: required=24, recommended=48 #define MAX_SPECTROGRAMS \ 32 // Current track: 14 unique, 32 provides comfortable headroom -- cgit v1.2.3