/// Get the exact configured sample rate from the speaker/microphone.
///
/// Marked unsafe because requires that one configuration is chosen.
Get the exact configured sample rate from the speaker/microphone.
Marked unsafe because requires that one configuration is chosen.
Get the exact configured sample rate from the speaker / microphone . Marked unsafe because requires that one configuration is chosen .
pub(crate) unsafe fn hw_get_rate(hw_params: *mut c_void) -> Option<f64> {
    ALSA.with(|alsa| {
        let alsa = if let Some(alsa) = alsa {
            alsa
        } else {
            return None;
        };
        let mut num = MaybeUninit::uninit();
        let mut den = MaybeUninit::uninit();
        let ret = (alsa.snd_pcm_hw_params_get_rate_numden)(
            hw_params,
            num.as_mut_ptr(),
            den.as_mut_ptr(),
        );
        let _err: usize = ret.try_into().ok()?;
        let num = num.assume_init();
        let den = den.assume_init();
        Some(num as f64 / den as f64)
    })
}
pub ( crate ) unsafe fn hw_get_rate ( hw_params : * mut c_void ) -> Option < f64 > { ALSA . with ( | alsa | { let alsa = if let Some ( alsa ) = alsa { alsa } else { return None ; } ; let mut num = MaybeUninit :: uninit ( ) ; let mut den = MaybeUninit :: uninit ( ) ; let ret = ( alsa . snd_pcm_hw_params_get_rate_numden ) ( hw_params , num . as_mut_ptr ( ) , den . as_mut_ptr ( ) , ) ; let _err : usize = ret . try_into ( ) . ok ( ) ? ; let num = num . assume_init ( ) ; let den = den . assume_init ( ) ; Some ( num as f64 / den as f64 ) } ) }
Get the exact configured sample rate from the speaker/microphone.
Get the exact configured sample rate from the speaker / microphone .
hw_params
*mut c_void