Struct cpal::SupportedStreamConfigRange
source · pub struct SupportedStreamConfigRange { /* private fields */ }
Expand description
Describes a range of supported stream configurations, retrieved via the
Device::supported_input/output_configs
method.
Implementations§
source§impl SupportedStreamConfigRange
impl SupportedStreamConfigRange
pub fn new( channels: ChannelCount, min_sample_rate: SampleRate, max_sample_rate: SampleRate, buffer_size: SupportedBufferSize, sample_format: SampleFormat ) -> Self
pub fn channels(&self) -> ChannelCount
pub fn min_sample_rate(&self) -> SampleRate
pub fn max_sample_rate(&self) -> SampleRate
pub fn buffer_size(&self) -> &SupportedBufferSize
pub fn sample_format(&self) -> SampleFormat
sourcepub fn with_sample_rate(self, sample_rate: SampleRate) -> SupportedStreamConfig
pub fn with_sample_rate(self, sample_rate: SampleRate) -> SupportedStreamConfig
Retrieve a SupportedStreamConfig
with the given sample rate and buffer size.
Panics
Panics if the given sample_rate
is outside the range specified within this
SupportedStreamConfigRange
instance.
sourcepub fn with_max_sample_rate(self) -> SupportedStreamConfig
pub fn with_max_sample_rate(self) -> SupportedStreamConfig
Turns this SupportedStreamConfigRange
into a SupportedStreamConfig
corresponding to the maximum samples rate.
sourcepub fn cmp_default_heuristics(&self, other: &Self) -> Ordering
pub fn cmp_default_heuristics(&self, other: &Self) -> Ordering
A comparison function which compares two SupportedStreamConfigRange
s in terms of their priority of
use as a default stream format.
Some backends do not provide a default stream format for their audio devices. In these cases, CPAL attempts to decide on a reasonable default format for the user. To do this we use the “greatest” of all supported stream formats when compared with this method.
SupportedStreamConfigs are prioritised by the following heuristics:
Channels:
- Stereo
- Mono
- Max available channels
Sample format:
- f32
- i16
- u16
Sample rate:
- 44100 (cd quality)
- Max sample rate
Trait Implementations§
source§impl Clone for SupportedStreamConfigRange
impl Clone for SupportedStreamConfigRange
source§fn clone(&self) -> SupportedStreamConfigRange
fn clone(&self) -> SupportedStreamConfigRange
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SupportedStreamConfigRange
impl Debug for SupportedStreamConfigRange
source§impl PartialEq for SupportedStreamConfigRange
impl PartialEq for SupportedStreamConfigRange
source§fn eq(&self, other: &SupportedStreamConfigRange) -> bool
fn eq(&self, other: &SupportedStreamConfigRange) -> bool
self
and other
values to be equal, and is used
by ==
.