fn default_format(&self) -> Result<SupportedStreamConfig, DefaultStreamConfigError> {
        // initializing COM because we call `CoTaskMemFree`
        com::com_initialized();

        let lock = match self.ensure_future_audio_client() {
            Ok(lock) => lock,
            Err(ref e) if e.raw_os_error() == Some(AUDCLNT_E_DEVICE_INVALIDATED) => {
                return Err(DefaultStreamConfigError::DeviceNotAvailable)
            }
            Err(e) => {
                let description = format!("{}", e);
                let err = BackendSpecificError { description };
                return Err(err.into());
            }
        };
        let client = lock.unwrap().0;

        unsafe {
            let mut format_ptr = WaveFormatExPtr(ptr::null_mut());
            match check_result((*client).GetMixFormat(&mut format_ptr.0)) {
                Err(ref e) if e.raw_os_error() == Some(AUDCLNT_E_DEVICE_INVALIDATED) => {
                    return Err(DefaultStreamConfigError::DeviceNotAvailable);
                }
                Err(e) => {
                    let description = format!("{}", e);
                    let err = BackendSpecificError { description };
                    return Err(err.into());
                }
                Ok(()) => (),
            };

            format_from_waveformatex_ptr(format_ptr.0)
                .ok_or(DefaultStreamConfigError::StreamTypeNotSupported)
        }
    }
// We always create voices in shared mode, therefore all samples go through an audio
// processor to mix them together.
//
// One format is guaranteed to be supported, the one returned by `GetMixFormat`.
We always create voices in shared mode, therefore all samples go through an audio
processor to mix them together.

One format is guaranteed to be supported, the one returned by `GetMixFormat`.
We always create voices in shared mode therefore all samples go through an audio processor to mix them together . One format is guaranteed to be supported the one returned by ` GetMixFormat ` .
fn default_format(&self) -> Result<SupportedStreamConfig, DefaultStreamConfigError> {
        // initializing COM because we call `CoTaskMemFree`
        com::com_initialized();
        let lock = match self.ensure_future_audio_client() {
            Ok(lock) => lock,
            Err(ref e) if e.raw_os_error() == Some(AUDCLNT_E_DEVICE_INVALIDATED) => {
                return Err(DefaultStreamConfigError::DeviceNotAvailable)
            }
            Err(e) => {
                let description = format!("{}", e);
                let err = BackendSpecificError { description };
                return Err(err.into());
            }
        };
        let client = lock.unwrap().0;
        unsafe {
            let mut format_ptr = WaveFormatExPtr(ptr::null_mut());
            match check_result((*client).GetMixFormat(&mut format_ptr.0)) {
                Err(ref e) if e.raw_os_error() == Some(AUDCLNT_E_DEVICE_INVALIDATED) => {
                    return Err(DefaultStreamConfigError::DeviceNotAvailable);
                }
                Err(e) => {
                    let description = format!("{}", e);
                    let err = BackendSpecificError { description };
                    return Err(err.into());
                }
                Ok(()) => (),
            };
            format_from_waveformatex_ptr(format_ptr.0)
                .ok_or(DefaultStreamConfigError::StreamTypeNotSupported)
        }
    }
fn default_format ( & self ) -> Result < SupportedStreamConfig , DefaultStreamConfigError > { // initializing COM because we call `CoTaskMemFree` com :: com_initialized ( ) ; let lock = match self . ensure_future_audio_client ( ) { Ok ( lock ) => lock , Err ( ref e ) if e . raw_os_error ( ) == Some ( AUDCLNT_E_DEVICE_INVALIDATED ) => { return Err ( DefaultStreamConfigError :: DeviceNotAvailable ) } Err ( e ) => { let description = format ! ( " " e ) ; let err = BackendSpecificError { description } ; return Err ( err . into ( ) ) ; } } ; let client = lock . unwrap ( ) . 0 ; unsafe { let mut format_ptr = WaveFormatExPtr ( ptr :: null_mut ( ) ) ; match check_result ( ( * client ) . GetMixFormat ( & mut format_ptr . 0 ) ) { Err ( ref e ) if e . raw_os_error ( ) == Some ( AUDCLNT_E_DEVICE_INVALIDATED ) => { return Err ( DefaultStreamConfigError :: DeviceNotAvailable ) ; } Err ( e ) => { let description = format ! ( " " e ) ; let err = BackendSpecificError { description } ; return Err ( err . into ( ) ) ; } Ok ( ( ) ) => ( ) , } ; format_from_waveformatex_ptr ( format_ptr . 0 ) . ok_or ( DefaultStreamConfigError :: StreamTypeNotSupported ) } }
We always create voices in shared mode, therefore all samples go through an audio
processor to mix them together.
We always create voices in shared mode therefore all samples go through an audio processor to mix them together .
&self
&self