Skip to main content

AudioPlaybackSettings

Struct AudioPlaybackSettings 

Source
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: u32

8000, 12000, 16000, 24000, or 48000.

§channels: i32

1 or 2.

§latency_ms: i32

The sink buffer’s target latency in milliseconds; must be positive.

§max_buffer_bytes: usize

The single byte bound on the drop-oldest playback queue; must be positive.

§debug_logging: bool

Print a status line every second.

Implementations§

Source§

impl AudioPlaybackSettings

Source

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

Source§

fn clone(&self) -> AudioPlaybackSettings

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AudioPlaybackSettings

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AudioPlaybackSettings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for AudioPlaybackSettings

Source§

impl PartialEq for AudioPlaybackSettings

Source§

fn eq(&self, other: &AudioPlaybackSettings) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AudioPlaybackSettings

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.