summaryrefslogtreecommitdiff
path: root/src/audio/audio.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-04 13:08:13 +0100
committerskal <pascal.massimino@gmail.com>2026-02-04 13:08:13 +0100
commitc4888bea71326f7a69e8214af0d9c2a62a60b887 (patch)
treedd1e71be51893414c590db8a7be578ddfd6232f0 /src/audio/audio.h
parentf64f842bb0dabd89308e2378e56358bc8abdd653 (diff)
feat(audio): Implement audio backend abstraction (Task #51.1)
Created interface-based audio backend system to enable testing without hardware. This is the foundation for robust tracker timing verification. Changes: - Created AudioBackend interface with init/start/shutdown methods - Added test-only hooks: on_voice_triggered() and on_frames_rendered() - Moved miniaudio implementation to MiniaudioBackend class - Refactored audio.cc to use backend abstraction with auto-fallback - Added time tracking to synth.cc (elapsed time from rendered frames) - Created test_audio_backend.cc to verify backend injection works - Fixed audio test linking to include util/procedural dependencies All test infrastructure guarded by #if !defined(STRIP_ALL) for zero size impact on final build. Production path unchanged, 100% backward compatible. All 13 tests pass. handoff(Claude): Task #51.1 complete, audio backend abstraction ready Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/audio/audio.h')
-rw-r--r--src/audio/audio.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/audio/audio.h b/src/audio/audio.h
index a1ddb44..52ad103 100644
--- a/src/audio/audio.h
+++ b/src/audio/audio.h
@@ -6,6 +6,9 @@
#include "generated/assets.h"
#include <cstdint>
+// Forward declaration for backend abstraction
+class AudioBackend;
+
struct SpecHeader {
char magic[4];
int32_t version;
@@ -17,7 +20,10 @@ void audio_init();
void audio_start(); // Starts the audio device callback
#if !defined(STRIP_ALL)
void audio_render_silent(float duration_sec); // Fast-forwards audio state
-#endif /* !defined(STRIP_ALL) */
+// Backend injection for testing
+void audio_set_backend(AudioBackend* backend);
+AudioBackend* audio_get_backend();
+#endif /* !defined(STRIP_ALL) */
void audio_update();
void audio_shutdown();