diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-05 18:43:12 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-05 18:43:12 +0100 |
| commit | 7721f574fad99949f85b4caf1e196b957fc0cf51 (patch) | |
| tree | d2e8bd881df5569332bc9e04e867453398a10d05 /CMakeLists.txt | |
| parent | dcda45d8ae46197d304d737c102b13643808203f (diff) | |
fix(audio): Resolve tracker test failures due to initialization order
Root Cause:
Tests were failing because synth_init() clears all registered spectrograms,
but tests called tracker_init() before or between synth_init() calls,
causing spectrograms to be registered then immediately cleared.
Fixes:
1. tracker.cc:
- Force re-initialization on every tracker_init() call
- Clear cache and re-register all spectrograms to handle synth resets
- Free previously allocated memory to prevent leaks
- Ensures spectrograms remain registered regardless of init order
2. synth.cc:
- Fixed backend event hooks wrapped in wrong conditional
- Changed #if defined(DEBUG_LOG_SYNTH) -> #if !defined(STRIP_ALL)
- Moved backend includes and g_elapsed_time_sec outside debug guards
- Ensures test backends receive voice trigger events
3. CMakeLists.txt:
- Added missing generate_demo_assets dependency to test_tracker
- Ensures asset files are available before running tracker tests
4. test_tracker.cc:
- Fixed incorrect test expectations (5 voices, not 6, at beat 1.0)
- Updated comments to reflect event-based triggering behavior
5. test_tracker_timing.cc, test_variable_tempo.cc, test_wav_dump.cc:
- Fixed initialization order: synth_init() BEFORE tracker_init()
- For tests using audio_init(), moved tracker_init() AFTER it
- Ensures spectrograms are registered after synth is ready
Test Results:
All 19 tests now pass (100% success rate).
Known Limitation:
This is a temporary fix. The initialization order dependency is fragile and
should be replaced with a proper lifecycle management system (see TODO Task #56).
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 06b142e..5d10039 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -320,7 +320,7 @@ if(DEMO_BUILD_TESTS) add_demo_test(test_tracker TrackerSystemTest src/tests/test_tracker.cc ${GEN_DEMO_CC} ${GENERATED_MUSIC_DATA_CC}) target_link_libraries(test_tracker PRIVATE audio util procedural ${DEMO_LIBS}) - add_dependencies(test_tracker generate_tracker_music) + add_dependencies(test_tracker generate_demo_assets generate_tracker_music) add_demo_test(test_shader_assets ShaderAssetValidation src/tests/test_shader_assets.cc ${GEN_DEMO_CC}) target_link_libraries(test_shader_assets PRIVATE util procedural ${DEMO_LIBS}) |
