From 798fc6d471a70ed930e5b1fc084818cb337ca5b1 Mon Sep 17 00:00:00 2001 From: skal Date: Thu, 5 Feb 2026 19:13:34 +0100 Subject: feat(audio): Implement AudioEngine and SpectrogramResourceManager (Task #56 Phase 1) Implements Phase 1 of the audio lifecycle refactor to eliminate initialization order dependencies between synth and tracker. New Components: 1. SpectrogramResourceManager (src/audio/spectrogram_resource_manager.{h,cc}) - Centralized resource loading and ownership - Lazy loading: resources registered but not loaded until needed - Handles both asset spectrograms and procedural notes - Clear ownership: assets borrowed, procedurals owned - Optional cache eviction under DEMO_ENABLE_CACHE_EVICTION flag 2. AudioEngine (src/audio/audio_engine.{h,cc}) - Unified audio subsystem manager - Single initialization point eliminates order dependencies - Manages synth, tracker, and resource manager lifecycle - Timeline seeking API for debugging (!STRIP_ALL) - Clean API: init(), shutdown(), reset(), seek() Features: - Lazy loading strategy with manual preload API - Reset functionality for timeline seeking - Zero impact on production builds - Debug-only seeking support Testing: - Comprehensive test suite (test_audio_engine.cc) - Tests lifecycle, resource loading, reset, seeking - All 20 tests passing (100% pass rate) Bug Fixes: - Fixed infinite recursion in AudioEngine::tracker_reset() Integration: - Added to CMakeLists.txt audio library - No changes to existing code (backward compatible) Binary Size Impact: ~700 bytes (within budget) Next: Phase 2 (Test Migration) - Update existing tests to use AudioEngine Co-Authored-By: Claude Sonnet 4.5 --- HANDOFF.md | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 HANDOFF.md (limited to 'HANDOFF.md') diff --git a/HANDOFF.md b/HANDOFF.md new file mode 100644 index 0000000..6143434 --- /dev/null +++ b/HANDOFF.md @@ -0,0 +1,98 @@ +# Session Handoff - February 5, 2026 + +## Session Summary +Enhanced Gantt chart visualization system with sequence names, adaptive tick intervals, and improved layout. + +## Completed Work + +### 1. Gantt Chart Enhancements (Commit: abd1d77) + +**Optional Sequence Names:** +- New syntax: `SEQUENCE ["name"] [optional_end]` +- Example: `SEQUENCE 0 0 "Opening Scene" [5.0]` +- Names displayed in both ASCII and HTML Gantt charts +- Backward compatible (names are optional) + +**Adaptive Tick Intervals:** +- Fixed hardcoded 5s ticks to be duration-based: + - ≤5s: 1s intervals + - ≤40s: 2s intervals (demo.seq now shows 0,2,4,6...36 instead of 0,5,10...35) + - ≤100s: 5s intervals + - >100s: 10s+ intervals +- Implemented in `calculate_tick_interval()` helper function + +**Chronological Sorting:** +- Sequences now displayed in start-time order regardless of definition order +- Applies to both ASCII and HTML output + +**Visual Separators:** +- Horizontal separator lines (────) between sequences in ASCII +- Dashed separator lines in HTML/SVG +- Improves readability for complex timelines + +**Files Modified:** +- `tools/seq_compiler.cc`: Core implementation (+111 lines) +- `doc/SEQUENCE.md`: Updated syntax reference with examples +- `assets/demo.seq`: Updated quick reference header + +## Current State + +**Build Status:** ✅ All targets building successfully +- Demo compiles and runs +- 14 sequences, 32.5s duration +- Gantt charts generated correctly + +**Documentation:** ✅ Up to date +- SEQUENCE.md includes name syntax and examples +- demo.seq quick reference updated +- No TODOs or pending documentation + +**Testing:** +- Verified with test files (test_names.seq) +- Confirmed sorting works with out-of-order sequences +- Tick intervals validated for various durations (12s, 32.5s) +- Generated files cleaned up + +## Generated Artifacts +- `demo_gantt.txt`: ASCII visualization with 2s ticks, 14 sequences sorted +- `demo_gantt.html`: Interactive HTML/SVG version +- Both available in project root (gitignored) + +## Architecture Notes + +**SequenceEntry Struct:** +```cpp +struct SequenceEntry { + std::string start_time; + std::string priority; + std::string end_time; // -1.0 = no explicit end + std::string name; // empty = no name + std::vector effects; +}; +``` + +**Name Parsing Logic:** +- Reads tokens after ` ` +- `"quoted string"` → sequence name (supports multi-word) +- `[bracketed]` → end time +- Both optional, order-independent +- Error on unrecognized tokens + +**Tick Interval Display:** +- ASCII: Iterates through columns, checks distance to tick positions +- HTML: Direct iteration through tick_interval values +- Both use same `calculate_tick_interval()` heuristic + +## Next Steps (None Pending) +- All requested features implemented +- No blocking issues or TODOs +- System ready for use + +## Session Context +- Started: Investigation of sequence end time verification (already completed) +- User requests: (1) Sort sequences by time, (2) Add separators, (3) Optional names, (4) Fix tick intervals +- All requests completed in single session +- Commit: "feat: Enhance Gantt charts with sequence names, adaptive ticks, and sorting" + +--- +*handoff(Claude): Gantt chart visualization enhanced with names, adaptive ticks, sorting, and separators. All features tested and documented.* -- cgit v1.2.3