voelin-audio no longer depends on tsclientlib or tsproto-packets. Its boundary is now plain types in packet.rs: TalkerId, VoiceCodec, VoicePacket (talker, seq, codec, whisper, payload) and EncodedVoice (codec, payload; an empty payload ends the transmission). The jitter buffer moves from tsclientlib::audio into jitter.rs and reads VoicePacket fields; the encoder returns EncodedVoice and the mixer is keyed by TalkerId. In voelin-core, voice.rs is the only place that wraps EncodedVoice into a TeamSpeak audio packet and reads one into a VoicePacket (codecs other than Opus are dropped there, where the jitter buffer rejected them before); audio.rs and session.rs work on the new types. voelinctl converts at its own edge. Behaviour is unchanged: the one-hour drift simulation gives the same latencies as before. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
61 lines
1.9 KiB
Rust
61 lines
1.9 KiB
Rust
//! Voice pipeline building blocks.
|
|
//!
|
|
//! - [`pcm`]: sample-rate constants, tone generation and detection helpers
|
|
//! - [`packet`]: the voice packet types the pipeline takes and produces
|
|
//! ([`VoicePacket`], [`EncodedVoice`]), independent of the transport
|
|
//! - [`encode`]: Opus encoding of 20 ms frames into [`EncodedVoice`]
|
|
//! - [`framer`]: slice an arbitrary sample stream into codec frames
|
|
//! - [`resample`]: sample-rate conversion to the 48 kHz the codec uses
|
|
//! - [`wav`]: WAV file input/output
|
|
//! - [`process`]: echo cancellation, noise suppression and gain control
|
|
//! - [`vad`]: voice activity detection
|
|
//! - [`jitter`]: the per-talker jitter buffer and Opus decoder
|
|
//! - [`mixer`]: per-talker volume, mute and priority dimming over the jitter
|
|
//! buffer, mixing to stereo
|
|
//! - [`settings`]: all user audio settings in one serde struct
|
|
//! - [`tap`]: the processed microphone for other consumers (the stream
|
|
//! mixer), free while nobody listens
|
|
//! - `device` (feature `device`): capture and playback through cpal, device
|
|
//! lists and loss detection
|
|
|
|
pub mod encode;
|
|
pub mod framer;
|
|
pub mod jitter;
|
|
pub mod mixer;
|
|
pub mod packet;
|
|
pub mod pcm;
|
|
pub mod process;
|
|
pub mod resample;
|
|
pub mod settings;
|
|
pub mod tap;
|
|
pub mod vad;
|
|
pub mod wav;
|
|
|
|
#[cfg(feature = "device")]
|
|
pub mod device;
|
|
|
|
pub use encode::VoiceEncoder;
|
|
pub use framer::Framer;
|
|
pub use jitter::AudioHandler;
|
|
pub use mixer::Mixer;
|
|
pub use packet::{EncodedVoice, TalkerId, VoiceCodec, VoicePacket};
|
|
pub use process::{ProcessingSettings, Processor};
|
|
pub use settings::AudioSettings;
|
|
pub use vad::{Vad, VadSettings};
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum Error {
|
|
#[error("opus: {0}")]
|
|
Opus(#[from] opus2::Error),
|
|
#[error("wav: {0}")]
|
|
Wav(#[from] hound::Error),
|
|
#[error("resampling failed: {0}")]
|
|
Resample(String),
|
|
#[error("audio device: {0}")]
|
|
Device(String),
|
|
#[error("invalid input: {0}")]
|
|
Invalid(String),
|
|
}
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|