pub fn open_queue<D: Into<Option<&'a str>>>(a: &AudioSubsystem, device: D, spec: &AudioSpecDesired) -> Result<AudioQueue<Channel>, String> {
        let desired = AudioSpecDesired::convert_queue_to_ll::<Channel, Option<i32>, Option<u8>, Option<u16>>(spec.freq, spec.channels, spec.samples);

        let mut obtained = unsafe { mem::uninitialized::<sys::SDL_AudioSpec>() };
        unsafe {
            let device = match device.into() {
                Some(device) => Some(CString::new(device).unwrap()),
                None => None
            };
            let device_ptr = device.map_or(ptr::null(), |s| s.as_ptr());

            let iscapture_flag = 0;
            let device_id = sys::SDL_OpenAudioDevice(
                device_ptr as *const c_char, iscapture_flag, &desired,
                &mut obtained, 0
            );
            match device_id {
                0 => {
                    Err(get_error())
                },
                id => {
                    let device_id = AudioDeviceID::PlaybackDevice(id);
                    let spec = AudioSpec::convert_from_ll(obtained);

                    Ok(AudioQueue {
                        subsystem: a.clone(),
                        device_id: device_id,
                        phantom: PhantomData::default(),
                        spec: spec,
                    })
                }
            }
        }
    }
/// Opens a new audio device given the desired parameters and callback.
Opens a new audio device given the desired parameters and callback.
Opens a new audio device given the desired parameters and callback .
pub fn open_queue<D: Into<Option<&'a str>>>(a: &AudioSubsystem, device: D, spec: &AudioSpecDesired) -> Result<AudioQueue<Channel>, String> {
        let desired = AudioSpecDesired::convert_queue_to_ll::<Channel, Option<i32>, Option<u8>, Option<u16>>(spec.freq, spec.channels, spec.samples);
        let mut obtained = unsafe { mem::uninitialized::<sys::SDL_AudioSpec>() };
        unsafe {
            let device = match device.into() {
                Some(device) => Some(CString::new(device).unwrap()),
                None => None
            };
            let device_ptr = device.map_or(ptr::null(), |s| s.as_ptr());
            let iscapture_flag = 0;
            let device_id = sys::SDL_OpenAudioDevice(
                device_ptr as *const c_char, iscapture_flag, &desired,
                &mut obtained, 0
            );
            match device_id {
                0 => {
                    Err(get_error())
                },
                id => {
                    let device_id = AudioDeviceID::PlaybackDevice(id);
                    let spec = AudioSpec::convert_from_ll(obtained);
                    Ok(AudioQueue {
                        subsystem: a.clone(),
                        device_id: device_id,
                        phantom: PhantomData::default(),
                        spec: spec,
                    })
                }
            }
        }
    }
pub fn open_queue < D : Into < Option < & ' a str > > > ( a : & AudioSubsystem , device : D , spec : & AudioSpecDesired ) -> Result < AudioQueue < Channel > , String > { let desired = AudioSpecDesired :: convert_queue_to_ll :: < Channel , Option < i32 > , Option < u8 > , Option < u16 > > ( spec . freq , spec . channels , spec . samples ) ; let mut obtained = unsafe { mem :: uninitialized :: < sys :: SDL_AudioSpec > ( ) } ; unsafe { let device = match device . into ( ) { Some ( device ) => Some ( CString :: new ( device ) . unwrap ( ) ) , None => None } ; let device_ptr = device . map_or ( ptr :: null ( ) , | s | s . as_ptr ( ) ) ; let iscapture_flag = 0 ; let device_id = sys :: SDL_OpenAudioDevice ( device_ptr as * const c_char , iscapture_flag , & desired , & mut obtained , 0 ) ; match device_id { 0 => { Err ( get_error ( ) ) } , id => { let device_id = AudioDeviceID :: PlaybackDevice ( id ) ; let spec = AudioSpec :: convert_from_ll ( obtained ) ; Ok ( AudioQueue { subsystem : a . clone ( ) , device_id : device_id , phantom : PhantomData :: default ( ) , spec : spec , } ) } } } }
Opens a new audio device given the desired parameters and callback.
Opens a new audio device given the desired parameters and callback .
a
&AudioSubsystem
device
D
spec
&AudioSpecDesired
a
&AudioSubsystem
device
D
spec
&AudioSpecDesired