Skip to main content

Output

Struct Output 

Source
pub struct Output { /* private fields */ }
Expand description

An open output. The callback runs until it is dropped.

Implementations§

Source§

impl Output

Source

pub fn preferred_rate() -> Option<u32>

The rate the device runs at, if there is one to ask: a mix at that rate needs no conversion on its way out.

Source

pub fn open( config: OutputConfig, callback: impl FnMut(&mut [i16]) + Send + 'static, ) -> Result<Self, OutputError>

Opens the system’s output, or says why it can’t.

Source

pub fn null( config: OutputConfig, callback: impl FnMut(&mut [i16]) + Send + 'static, ) -> Self

An output that calls callback on a timer and discards what it gives.

Source

pub fn open_or_null( config: OutputConfig, callback: impl FnMut(&mut [i16]) + Send + 'static, ) -> (Self, Option<OutputError>)

The system’s output, or, if it won’t open, null and why: no sound rather than a crash, and the caller’s to say once.

Source

pub const fn rate(&self) -> u32

The rate its callback’s samples play at.

Source

pub fn stats(&self) -> (u32, u32)

How many times the system’s stream was built again, as when its device went away, and how many of its callbacks were silence instead of the mix. Nothing asks this but a probe, to say what a recording went through: 0 and 0 where there is no stream to build.

Source

pub fn suspend(&self)

Stops calling the callback, for as long as the system suspends the game.

Source

pub fn resume(&self)

Goes on calling it after suspend.

Trait Implementations§

Source§

impl Debug for Output

Source§

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

Formats the value using the given formatter. Read more

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> 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, 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.