summaryrefslogtreecommitdiff
path: root/src/tests/test_wav_dump.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-05 19:59:21 +0100
committerskal <pascal.massimino@gmail.com>2026-02-05 19:59:21 +0100
commit6c09e3bdb5128dca64c457c3a6ebeb32adf98c10 (patch)
treed943db66547776c295c1895852eaf9a8cbec506b /src/tests/test_wav_dump.cc
parent64c19b368db4aea748467b5f763add99c7deb701 (diff)
feat(audio): Complete Phase 2 - Migrate tests to AudioEngine (Task #56)
Migrated all tracker-related tests to use AudioEngine instead of directly calling synth_init() and tracker_init(), eliminating fragile initialization order dependencies. Tests Migrated: - test_tracker.cc: Basic tracker functionality - test_tracker_timing.cc: Timing verification with MockAudioBackend (7 tests) - test_variable_tempo.cc: Variable tempo scaling (6 tests) - test_wav_dump.cc: WAV dump backend verification Migration Pattern: - Added AudioEngine include to all test files - Replaced synth_init() + tracker_init() with AudioEngine::init() - Replaced tracker_update(time) with engine.update(time) - Added engine.shutdown() at end of each test function - Preserved audio_init()/audio_shutdown() where needed for backends Results: - All 20 tests pass (100% pass rate) - Test suite time: 8.13s (slightly faster) - No regressions in test behavior - Cleaner API with single initialization entry point Next Steps (Phase 3): - Migrate main.cc and production code to use AudioEngine - Add backwards compatibility shims during transition handoff(Claude): Completed Task #56 Phase 2 - all tracker tests now use AudioEngine. The initialization order fragility is eliminated in test code. Ready for Phase 3 (production integration).
Diffstat (limited to 'src/tests/test_wav_dump.cc')
-rw-r--r--src/tests/test_wav_dump.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/tests/test_wav_dump.cc b/src/tests/test_wav_dump.cc
index f350330..c68578b 100644
--- a/src/tests/test_wav_dump.cc
+++ b/src/tests/test_wav_dump.cc
@@ -2,8 +2,7 @@
// Regression test for WAV dump backend to prevent format mismatches.
#include "audio/audio.h"
-#include "audio/synth.h"
-#include "audio/tracker.h"
+#include "audio/audio_engine.h"
#include "audio/wav_dump_backend.h"
#include <assert.h>
#include <stdio.h>
@@ -42,21 +41,23 @@ void test_wav_format_matches_live_audio() {
// Initialize audio system (calls synth_init internally)
audio_init();
- // Initialize tracker AFTER audio_init to ensure spectrograms stay registered
- tracker_init();
+ // Initialize AudioEngine (replaces direct synth_init/tracker_init)
+ AudioEngine engine;
+ engine.init();
// Manually trigger some audio for testing
- tracker_update(0.0f); // Trigger patterns at t=0
+ engine.update(0.0f); // Trigger patterns at t=0
// Render short duration (1 second = 60 updates @ 60Hz)
for (int i = 0; i < 60; ++i) {
float t = i / 60.0f;
- tracker_update(t);
+ engine.update(t);
// Simulate audio render (WavDumpBackend will handle this in start())
}
audio_start(); // This triggers the actual WAV rendering
+ engine.shutdown();
audio_shutdown();
// Read and verify WAV header