blob: 4a2b7fb0869705a463d9dde5c03bc2bcbcc64e69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// This file is part of the 64k demo project.
// It defines the interface for audio backend implementations.
// Enables testing without hardware by abstracting audio output.
#pragma once
// AudioBackend interface for audio output abstraction
// Production uses MiniaudioBackend, tests use MockAudioBackend
class AudioBackend {
public:
virtual ~AudioBackend() {}
// Initialize backend resources
virtual void init() = 0;
// Start audio playback/recording
virtual void start() = 0;
// Clean up backend resources
virtual void shutdown() = 0;
#if !defined(STRIP_ALL)
// Hook called when a voice is triggered (test-only)
// timestamp: Time in seconds when voice was triggered
// spectrogram_id: ID of the spectrogram being played
// volume: Voice volume (0.0 - 1.0)
// pan: Pan position (-1.0 left, 0.0 center, 1.0 right)
virtual void on_voice_triggered(float timestamp, int spectrogram_id,
float volume, float pan) {
// Default implementation does nothing (production path)
(void)timestamp;
(void)spectrogram_id;
(void)volume;
(void)pan;
}
// Hook called after rendering audio frames (test-only)
// num_frames: Number of frames rendered
virtual void on_frames_rendered(int num_frames) {
// Default implementation does nothing (production path)
(void)num_frames;
}
#endif /* !defined(STRIP_ALL) */
};
|