pub struct AudioPlaybackSettings {
pub device_name: Option<String>,
pub sample_rate: u32,
pub channels: i32,
pub latency_ms: i32,
pub max_buffer_bytes: usize,
pub debug_logging: bool,
}Expand description
Mic-playback configuration, read once by AudioPlayback::start, so the playback
thread owns an immutable copy for the run’s lifetime. Default is the configuration
the Python AudioPlaybackSettings starts with, matching the client mic wire: the
input sink, S16LE mono at 24 kHz, a 40 ms sink buffer, and a queue bound of 96000
bytes (about 2 s).
Fields§
§device_name: Option<String>The PulseAudio sink to play into; None or empty for the system default.
sample_rate: u328000, 12000, 16000, 24000, or 48000.
channels: i321 or 2.
latency_ms: i32The sink buffer’s target latency in milliseconds; must be positive.
max_buffer_bytes: usizeThe single byte bound on the drop-oldest playback queue; must be positive.
debug_logging: boolPrint a status line every second.
Implementations§
Source§impl AudioPlaybackSettings
impl AudioPlaybackSettings
Sourcepub fn validate(&self) -> Result<AudioPlaybackSettings, Error>
pub fn validate(&self) -> Result<AudioPlaybackSettings, Error>
The settings a run snapshots, or why they are refused: what the playback thread could only fail on later is rejected here, before a thread is spawned.
latency_ms must be positive: it sizes the sink buffer, and a zero target would
make PulseAudio start playback with nothing prebuffered and underrun on every write.
max_buffer_bytes must be positive: it bounds the drop-oldest queue, and a zero
bound would discard every chunk as soon as it was queued. device_name is checked
as the capture’s is.
Trait Implementations§
Source§impl Clone for AudioPlaybackSettings
impl Clone for AudioPlaybackSettings
Source§fn clone(&self) -> AudioPlaybackSettings
fn clone(&self) -> AudioPlaybackSettings
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more