Print the list of audio drivers so you can try each one
authorSam Lantinga <slouken@libsdl.org>
Thu, 29 Nov 2012 09:48:42 -0800
changeset 6715 a02458e71c95
parent 6714 146d1d7ecdc4
child 6716 1616f6b3738c
Print the list of audio drivers so you can try each one
test/loopwave.c
--- a/test/loopwave.c	Thu Nov 29 00:45:36 2012 -0800
+++ b/test/loopwave.c	Thu Nov 29 09:48:42 2012 -0800
@@ -78,6 +78,8 @@
 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 @@
     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 @@
     SDL_Quit();
     return (0);
 }
+
+/* vi: set ts=4 sw=4 expandtab: */