Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Print the list of audio drivers so you can try each one
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Nov 29, 2012
1 parent 7020b3f commit c31db37
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/loopwave.c
Expand Up @@ -78,6 +78,8 @@ poked(int sig)
int
main(int argc, char *argv[])
{
int i;

/* Load the SDL library */
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
Expand Down Expand Up @@ -106,6 +108,17 @@ main(int argc, char *argv[])
signal(SIGTERM, poked);
#endif /* HAVE_SIGNAL_H */

/* Show the list of available drivers */
printf("Available audio drivers: ");
for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
if (i == 0) {
printf("%s", SDL_GetAudioDriver(i));
} else {
printf(", %s", SDL_GetAudioDriver(i));
}
}
printf("\n");

/* Initialize fillerup() variables */
if (SDL_OpenAudio(&wave.spec, NULL) < 0) {
fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
Expand All @@ -126,3 +139,5 @@ main(int argc, char *argv[])
SDL_Quit();
return (0);
}

/* vi: set ts=4 sw=4 expandtab: */

0 comments on commit c31db37

Please sign in to comment.