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: u32The 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: u32The largest block the callback can be handed. Audio-thread buffers are
sized from this so process() never has to grow one.
channels: u16Output channel count.
sample_rate_request: RequestedWhat became of the sample rate on the command line.
buffer_size_request: RequestedWhat became of the block size on the command line.
Implementations§
Source§impl StreamFormat
impl StreamFormat
Sourcepub fn divergence_notice(&self) -> Option<String>
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
impl Clone for StreamFormat
Source§fn clone(&self) -> StreamFormat
fn clone(&self) -> StreamFormat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for StreamFormat
Source§impl Debug for StreamFormat
impl Debug for StreamFormat
impl Eq for StreamFormat
Source§impl From<StreamFormat> for EngineConfig
impl From<StreamFormat> for EngineConfig
Source§fn from(format: StreamFormat) -> Self
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.