This is new wiki software and old wiki content. It's a work in progress!
Here's the explanation.
Be gentle, report bugs, leave feedback on pages, or just edit them yourself! Thanks!

SDL Wiki


This function is a legacy means of querying the audio device. New programs might want to use SDL_GetAudioDeviceStatus() instead.


SDL_AudioStatus SDL_GetAudioStatus(void)

Return Value

Returns the SDL_AudioStatus of the specified audio device which may be one of the following: <<Include(SDL_AudioStatus, , , from="== Values ==", to="== Code Examples ==")>>

Code Examples

void printStatus(void)
    switch (SDL_GetAudioStatus())
        case SDL_AUDIO_STOPPED: printf("stopped\n"); break;
        case SDL_AUDIO_PLAYING: printf("playing\n"); break;
        case SDL_AUDIO_PAUSED: printf("paused\n"); break;
        default: printf("???"); break;

extern SDL_AudioSpec desired;
extern SDL_AudioSpec obtained;

// device starts paused
if (SDL_OpenAudio(&desired, &obtained) == 0) {
     printStatus();  // prints "paused"
     printStatus();  // prints "playing"
     printStatus();  // prints "paused"
     printStatus();  // prints "stopped"


This function is equivalent to calling


and is only useful if you used the legacy SDL_OpenAudio() function.


CategoryAPI, CategoryAudio

[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.