41 lines
1.1 KiB
C
41 lines
1.1 KiB
C
|
|
/*
|
|||
|
|
* audio/audio_engine.h — capture/playback + DSP + jitter buffer + mixer.
|
|||
|
|
*
|
|||
|
|
* Design: docs/voice.md §8–11. Real-time path:
|
|||
|
|
* capture(miniaudio) → APM(AEC/NS/AGC/VAD, send-side) → Opus encode → ...
|
|||
|
|
* ... → Opus decode → per-user recv NS (listener-chosen) → gain/mute → mix → playback
|
|||
|
|
*
|
|||
|
|
* REAL-TIME RULE: audio-callback threads never allocate, lock, or block (architecture.md §3).
|
|||
|
|
*
|
|||
|
|
* STATUS: M0 stub.
|
|||
|
|
*/
|
|||
|
|
#ifndef VOICECAT_AUDIO_AUDIO_ENGINE_H
|
|||
|
|
#define VOICECAT_AUDIO_AUDIO_ENGINE_H
|
|||
|
|
|
|||
|
|
#include <cstdint>
|
|||
|
|
|
|||
|
|
namespace voicecat::audio {
|
|||
|
|
|
|||
|
|
// Adaptive per-ssrc jitter buffer (voice.md §5). TODO(M2).
|
|||
|
|
class JitterBuffer {
|
|||
|
|
public:
|
|||
|
|
uint32_t target_depth_ms() const { return target_depth_ms_; }
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
uint32_t target_depth_ms_ = 40;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// Owns miniaudio capture/playback, the APM instances, codecs, jitter buffers, and the mixer.
|
|||
|
|
class AudioEngine {
|
|||
|
|
public:
|
|||
|
|
// TODO(M2): start/stop capture+playback; push/pull frames via lock-free ring buffers.
|
|||
|
|
bool running() const { return running_; }
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
bool running_ = false;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
} // namespace voicecat::audio
|
|||
|
|
|
|||
|
|
#endif // VOICECAT_AUDIO_AUDIO_ENGINE_H
|