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

SDL_GetAudioStatus

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

Syntax

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"
     SDL_PauseAudio(0);
     printStatus();  // prints "playing"
     SDL_PauseAudio(1);
     printStatus();  // prints "paused"
     SDL_CloseAudio();
     printStatus();  // prints "stopped"
}

Remarks

This function is equivalent to calling

SDL_GetAudioDeviceStatus(1);

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

SDL_GetAudioDeviceStatus

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.