Call SDL_Init() before SDL_GetNumAudioDrivers().
authorRyan C. Gordon
Sun, 10 Jan 2010 19:09:57 +0000
changeset 36355ea5e4e6103f
parent 3634 1e31a24c41a6
child 3636 e474a820daeb
Call SDL_Init() before SDL_GetNumAudioDrivers().

Not sure why that was reversed.
test/testaudioinfo.c
     1.1 --- a/test/testaudioinfo.c	Sun Jan 10 18:25:04 2010 +0000
     1.2 +++ b/test/testaudioinfo.c	Sun Jan 10 19:09:57 2010 +0000
     1.3 @@ -25,6 +25,12 @@
     1.4  int
     1.5  main(int argc, char **argv)
     1.6  {
     1.7 +    /* Load the SDL library */
     1.8 +    if (SDL_Init(SDL_INIT_AUDIO) < 0) {
     1.9 +        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.10 +        return (1);
    1.11 +    }
    1.12 +
    1.13      /* Print available audio drivers */
    1.14      int n = SDL_GetNumAudioDrivers();
    1.15      if (n == 0) {
    1.16 @@ -38,12 +44,6 @@
    1.17          printf("\n");
    1.18      }
    1.19  
    1.20 -    /* Load the SDL library */
    1.21 -    if (SDL_Init(SDL_INIT_AUDIO) < 0) {
    1.22 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.23 -        return (1);
    1.24 -    }
    1.25 -
    1.26      printf("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver());
    1.27  
    1.28      print_devices(0);