Expand description
Audio source/sink traits.
These are the seam the WaveKat audio pipeline is drawn against:
whatever produces audio (a microphone, a TTS engine, a WAV file)
implements AudioSource; whatever consumes it (a speaker, an
RTP encoder, an ASR worker) implements AudioSink. Concrete
impls live in the consuming crates — cpal-backed mic/speaker in
wavekat-voice, a future agent-driven impl in wavekat-agent,
and so on — so that adding a new producer or consumer is “implement
the trait” rather than “rewrite the RTP path.”
The traits speak in AudioFrame<'static>: sample-rate-tagged
frames so consumers can resample to whatever rate the codec wants
without either side of the trait having to know the codec exists.
Traits§
- Audio
Sink - Consumes audio frames. Implementations may drop frames on backpressure rather than block the caller; the alternative — stalling — is worse on the RTP receive path, where it stalls the whole pipeline.
- Audio
Source - Produces owned
AudioFrames.next_frame().awaitreturns the next frame when one is available, orNoneonce the source has run out (file ended, device closed, dialogue terminated). Each frame’sAudioFrame::sample_rateis set by the implementation — consumers resample as needed.