Chapter 10. Audio

Table of Contents
SDL_AudioSpec -- Audio Specification Structure
SDL_OpenAudio -- Opens the audio device with the desired parameters.
SDL_PauseAudio -- Pauses and unpauses the audio callback processing
SDL_GetAudioStatus -- Get the current audio state
SDL_LoadWAV -- Load a WAVE file
SDL_FreeWAV -- Frees previously opened WAV data
SDL_AudioCVT -- Audio Conversion Structure
SDL_BuildAudioCVT -- Initializes a SDL_AudioCVT structure for conversion
SDL_ConvertAudio -- Convert audio data to a desired audio format.
SDL_MixAudio -- Mix audio data
SDL_LockAudio -- Lock out the callback function
SDL_UnlockAudio -- Unlock the callback function
SDL_CloseAudio -- Shuts down audio processing and closes the audio device.

Sound on the computer is translated from waves that you hear into a series of values, or samples, each representing the amplitude of the wave. When these samples are sent in a stream to a sound card, an approximation of the original wave can be recreated. The more bits used to represent the amplitude, and the greater frequency these samples are gathered, the closer the approximated sound is to the original, and the better the quality of sound.

This library supports both 8 and 16 bit signed and unsigned sound samples, at frequencies ranging from 11025 Hz to 44100 Hz, depending on the underlying hardware. If the hardware doesn't support the desired audio format or frequency, it can be emulated if desired (See SDL_OpenAudio())

A commonly supported audio format is 16 bits per sample at 22050 Hz.