Call SDL_Init() before SDL_GetNumAudioDrivers().
authorRyan C. Gordon <icculus@icculus.org>
Sun, 10 Jan 2010 19:09:57 +0000
changeset 3635 5ea5e4e6103f
parent 3634 1e31a24c41a6
child 3636 e474a820daeb
Call SDL_Init() before SDL_GetNumAudioDrivers(). Not sure why that was reversed.
test/testaudioinfo.c
--- a/test/testaudioinfo.c	Sun Jan 10 18:25:04 2010 +0000
+++ b/test/testaudioinfo.c	Sun Jan 10 19:09:57 2010 +0000
@@ -25,6 +25,12 @@
 int
 main(int argc, char **argv)
 {
+    /* Load the SDL library */
+    if (SDL_Init(SDL_INIT_AUDIO) < 0) {
+        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        return (1);
+    }
+
     /* Print available audio drivers */
     int n = SDL_GetNumAudioDrivers();
     if (n == 0) {
@@ -38,12 +44,6 @@
         printf("\n");
     }
 
-    /* Load the SDL library */
-    if (SDL_Init(SDL_INIT_AUDIO) < 0) {
-        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
-        return (1);
-    }
-
     printf("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver());
 
     print_devices(0);