Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Print the list of audio drivers so you can try each one

  • Loading branch information
slouken committed Nov 29, 2012
1 parent 7020b3f commit c31db37bc1289c0ef7af70bdbd2474406a4cc7b4
Showing with 15 additions and 0 deletions.
  1. +15 −0 test/loopwave.c
@@ -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());
@@ -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());
@@ -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.