Skip to main content

StreamFormat

Struct StreamFormat 

Source
pub struct StreamFormat {
    pub sample_rate: u32,
    pub buffer_size: Option<u32>,
    pub max_buffer_frames: u32,
    pub channels: u16,
    pub sample_rate_request: Requested,
    pub buffer_size_request: Requested,
}
Expand description

The stream format the device agreed to, and what became of the request.

Fields§

§sample_rate: u32

The rate the stream actually runs at. Every oscillator increment, envelope time and transport advance must be derived from this number.

§buffer_size: Option<u32>

The block size pinned on the stream, or None when the device was left to choose. Nominal even when it is Some: what the callback is actually handed varies from block to block and is scaled by any rate conversion in between. Use it for reporting latency, never for sizing a buffer.

§max_buffer_frames: u32

The largest block the callback can be handed. Audio-thread buffers are sized from this so process() never has to grow one.

§channels: u16

Output channel count.

§sample_rate_request: Requested

What became of the sample rate on the command line.

§buffer_size_request: Requested

What became of the block size on the command line.

Implementations§

Source§

impl StreamFormat

Source

pub fn divergence_notice(&self) -> Option<String>

What the player needs to be told, or None when there is nothing to tell them.

Following the device is the ordinary case and says nothing. Only a refusal is news: they asked for something and are not getting it, and a session that is silently a semitone and a half sharp is exactly the failure this whole path exists to prevent.

Trait Implementations§

Source§

impl Clone for StreamFormat

Source§

fn clone(&self) -> StreamFormat

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 Copy for StreamFormat

Source§

impl Debug for StreamFormat

Source§

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

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

impl Eq for StreamFormat

Source§

impl From<StreamFormat> for EngineConfig

Source§

fn from(format: StreamFormat) -> Self

The config the engine must be built from once a device has been opened.

buffer_size falls back to the largest block the device may deliver when the device was left to choose its own: nothing sizes a buffer from this field any more — the mixer takes max_buffer_frames directly — so the honest value for a block size we were never told is the worst case rather than a guess.

Source§

impl PartialEq for StreamFormat

Source§

fn eq(&self, other: &StreamFormat) -> 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 StreamFormat

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = !

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more