INNER CODE UNIT · Rust

try_with_standard_sample_rate

RustAudio/cpal · src/lib.rs:765

    pub fn try_with_standard_sample_rate(self) -> Option<SupportedStreamConfig> {
        for rate in [SAMPLE_RATE_48K, SAMPLE_RATE_CD] {
            if self.contains_rate(rate) {
                return Some(self.with_sample_rate(rate));
            }
        }
        None
    }

    /// 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.
    /// 2. 44.1 kHz as the standard CD/consumer rate.
    ///
    /// # Panics
    ///
    /// Panics if neither standard rate falls within the range specified within this

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…