[][src]Function sdl2_sys::SDL_OpenAudio

pub unsafe extern "C" fn SDL_OpenAudio(
    desired: *mut SDL_AudioSpec,
    obtained: *mut SDL_AudioSpec
) -> c_int

This function opens the audio device with the desired parameters, and returns 0 if successful, placing the actual hardware parameters in the structure pointed to by \c obtained. If \c obtained is NULL, the audio data passed to the callback function will be guaranteed to be in the requested format, and will be automatically converted to the hardware audio format if necessary. This function returns -1 if it failed to open the audio device, or couldn't set up the audio thread.

When filling in the desired audio spec structure,

The audio device starts out playing silence when it's opened, and should be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready for your audio callback function to be called. Since the audio driver may modify the requested size of the audio buffer, you should allocate any local mixing buffers after you open the audio device.