INNER CODE UNIT · Rust
with_max_sample_rate
RustAudio/cpal · src/lib.rs:743
pub fn with_max_sample_rate(self) -> SupportedStreamConfig {
SupportedStreamConfig {
channels: self.channels,
sample_rate: self.max_sample_rate,
sample_format: self.sample_format,
buffer_size: self.buffer_size,
}
}
/// Returns `true` if `rate` falls within `[min_sample_rate, max_sample_rate]`.
pub fn contains_rate(&self, rate: SampleRate) -> bool {
self.min_sample_rate <= rate && rate <= self.max_sample_rate
}
/// Retrieve a [`SupportedStreamConfig`] with a standard sample rate.
///
/// The preferred rate is selected in order:
/// 1. 48 kHz as the dominant native rate on modern hardware.