### Header File

The header file may include additional information sdl_audio.hrl

### Exports

audioDrivername()

Args: none
Returns: DriverName(String) or []
C-API: char *SDL_AudioDriverName(char *namebuf, int maxlen);

openAudio(Desired, ForceFormat)

Args: DesiredFormat (audiospec-record), ForceFormat (true | false)
Returns: ObtainedFormat or exit(audio_failure)
C-API: int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);

closeAudio()

Args: none
Returns: ok
C-API: void SDL_CloseAudio(void);

getAudioStatus()

Args: none
Returns: Status
C-API: SDL_audiostatus SDL_GetAudioStatus(void);

pauseAudio(true)

Args: [true | false]
Returns: ok
C-API: void SDL_PauseAudio(int pause_on);

loadWAV(File)

Args: FileName
Returns: {AudioSpec, AudioBufferPtr} or exits
C-API: SDL_AudioSpec *SDL_LoadWAV(char *file, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)

freeWAV(#audiop{ptr=Ptr})

Args: AudioWavRef
Returns: ok
C-API: void SDL_FreeWAV(Uint8 *audio_buf);

play_audio(#audiop{ptr=Ptr,size=Size}, Repeat)

Args: AudioWavRef, SampleLen, Repeat (integer or infinity)
Returns: ok
Desc:
Used to start audio playing

convertAudio(FromAS, ToAS, #audiop{ptr=Ptr,size=Size})

Args: FromAudioSpec, ToAudioSpec, SampleBuffer
Returns: NewBuffer or exists if conversion failed
C-API: int SDL_ConvertAudio(SDL_AudioCVT *cvt);
Desc:
This differs from the orginal SDL function in both syntax and semantics, convertAudio handles the buildCVT and other things SDL requires. convertAudio converts Buffer (in 'FromAudioSpec' format) and returns a new audio buffer (in 'ToAudioSpec' format) Don't forget to call freeWav with old Buffer