SDL_AudioSpec Struct Reference

`#include <SDL_audio.h>`

## Data Fields

int | freq
SDL_AudioFormat | format
Uint8 | channels
Uint8 | silence
Uint16 | samples
Uint16 | padding
Uint32 | size
SDL_AudioCallback | callback
void * | userdata

## Detailed Description

The calculated values in this structure are calculated by SDL_OpenAudio().

For multi-channel audio, the default SDL channel mapping is: 2: FL FR (stereo) 3: FL FR LFE (2.1 surround) 4: FL FR BL BR (quad) 5: FL FR FC BL BR (quad + center) 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) 7: FL FR FC LFE BC SL SR (6.1 surround) 8: FL FR FC LFE BL BR SL SR (7.1 surround)

Definition at line 177 of file SDL_audio.h.

## Field Documentation

## callback

SDL_AudioCallback SDL_AudioSpec::callback

Callback that feeds the audio device (NULL to use SDL_QueueAudio()).

Definition at line 186 of file SDL_audio.h.

Referenced by audio_initOpenCloseQuitAudio(), audio_lockUnlockOpenAudioDevice(), audio_openCloseAndGetAudioStatus(), audio_openCloseAudioDeviceConnected(), audio_pauseUnpauseAudio(), iteration(), main(), open_audio_device(), SDL_CaptureAudio(), SDL_DequeueAudio(), SDL_GetQueuedAudioSize(), SDL_QueueAudio(), SDL_RunAudio(), and test_multi_audio().

## channels

Uint8 SDL_AudioSpec::channels

Number of channels: 1 mono, 2 stereo

Definition at line 181 of file SDL_audio.h.

Referenced by audio_buildAudioCVT(), audio_buildAudioCVTNegative(), audio_convertAudio(), audio_initOpenCloseQuitAudio(), audio_lockUnlockOpenAudioDevice(), audio_openCloseAndGetAudioStatus(), audio_openCloseAudioDeviceConnected(), audio_pauseUnpauseAudio(), main(), open_audio_device(), prepare_audiospec(), SDL_CalculateAudioSpec(), SDL_LoadWAV_RW(), SDLTest_CommonArg(), and SDLTest_CommonCreateState().

## format

SDL_AudioFormat SDL_AudioSpec::format

Audio data format

Definition at line 180 of file SDL_audio.h.

Referenced by audio_buildAudioCVT(), audio_buildAudioCVTNegative(), audio_convertAudio(), audio_initOpenCloseQuitAudio(), audio_lockUnlockOpenAudioDevice(), audio_openCloseAndGetAudioStatus(), audio_openCloseAudioDeviceConnected(), audio_pauseUnpauseAudio(), main(), open_audio_device(), prepare_audiospec(), SDL_CalculateAudioSpec(), SDL_LoadWAV_RW(), SDL_MixAudio(), SDLTest_CommonArg(), and SDLTest_CommonCreateState().

## freq

int SDL_AudioSpec::freq

DSP frequency – samples per second

Definition at line 179 of file SDL_audio.h.

Referenced by audio_buildAudioCVT(), audio_buildAudioCVTNegative(), audio_convertAudio(), audio_initOpenCloseQuitAudio(), audio_lockUnlockOpenAudioDevice(), audio_openCloseAndGetAudioStatus(), audio_openCloseAudioDeviceConnected(), audio_pauseUnpauseAudio(), main(), open_audio_device(), prepare_audiospec(), SDL_CaptureAudio(), SDL_LoadWAV_RW(), SDL_RunAudio(), SDLTest_CommonArg(), and SDLTest_CommonCreateState().

## padding

Uint16 SDL_AudioSpec::padding

Necessary for some compile environments

Definition at line 184 of file SDL_audio.h.

## samples

Uint16 SDL_AudioSpec::samples

Audio buffer size in sample FRAMES (total samples divided by channel count)

Definition at line 183 of file SDL_audio.h.

Referenced by audio_initOpenCloseQuitAudio(), audio_lockUnlockOpenAudioDevice(), audio_openCloseAndGetAudioStatus(), audio_openCloseAudioDeviceConnected(), audio_pauseUnpauseAudio(), DUMMYAUDIO_CaptureFromDevice(), main(), open_audio_device(), prepare_audiospec(), SDL_CalculateAudioSpec(), SDL_CaptureAudio(), SDL_LoadWAV_RW(), SDL_RunAudio(), SDLTest_CommonArg(), and SDLTest_CommonCreateState().

## silence

Uint8 SDL_AudioSpec::silence

Audio buffer silence value (calculated)

Definition at line 182 of file SDL_audio.h.

Referenced by DUMMYAUDIO_CaptureFromDevice(), play_through_once(), SDL_BufferQueueDrainCallback(), SDL_CalculateAudioSpec(), SDL_CaptureAudio(), SDL_OpenAudio(), and SDL_RunAudio().

## size

Uint32 SDL_AudioSpec::size

Audio buffer size in bytes (calculated)

Definition at line 185 of file SDL_audio.h.

Referenced by open_audio_device(), SDL_CalculateAudioSpec(), SDL_CaptureAudio(), SDL_OpenAudio(), and SDL_RunAudio().

## userdata

void* SDL_AudioSpec::userdata

Userdata passed to callback (ignored for NULL callbacks).

Definition at line 187 of file SDL_audio.h.

Referenced by audio_initOpenCloseQuitAudio(), audio_lockUnlockOpenAudioDevice(), audio_openCloseAndGetAudioStatus(), audio_openCloseAudioDeviceConnected(), audio_pauseUnpauseAudio(), iteration(), open_audio_device(), SDL_CaptureAudio(), SDL_RunAudio(), and test_multi_audio().

The documentation for this struct was generated from the following file:

- include/SDL_audio.h