test/testaudioinfo.c
changeset 10413 636499ff46f8
parent 9998 f67cf37e9cd4
child 10737 3406a0f8b041
     1.1 --- a/test/testaudioinfo.c	Sat Oct 01 12:28:05 2016 -0700
     1.2 +++ b/test/testaudioinfo.c	Sat Oct 01 12:29:55 2016 -0700
     1.3 @@ -18,7 +18,7 @@
     1.4      const char *typestr = ((iscapture) ? "capture" : "output");
     1.5      int n = SDL_GetNumAudioDevices(iscapture);
     1.6  
     1.7 -    SDL_Log("%s devices:\n", typestr);
     1.8 +    SDL_Log("Found %d %s device%s:\n", n, typestr, n != 1 ? "s" : "");
     1.9  
    1.10      if (n == -1)
    1.11          SDL_Log("  Driver can't detect specific %s devices.\n\n", typestr);
    1.12 @@ -27,7 +27,11 @@
    1.13      else {
    1.14          int i;
    1.15          for (i = 0; i < n; i++) {
    1.16 -            SDL_Log("  %s\n", SDL_GetAudioDeviceName(i, iscapture));
    1.17 +            const char *name = SDL_GetAudioDeviceName(i, iscapture);
    1.18 +            if (name != NULL)
    1.19 +                SDL_Log("  %d: %s\n", i, name);
    1.20 +            else
    1.21 +                SDL_Log("  %d Error: %s\n", i, SDL_GetError());
    1.22          }
    1.23          SDL_Log("\n");
    1.24      }
    1.25 @@ -55,9 +59,9 @@
    1.26          int i;
    1.27          SDL_Log("Built-in audio drivers:\n");
    1.28          for (i = 0; i < n; ++i) {
    1.29 -            SDL_Log("  %s\n", SDL_GetAudioDriver(i));
    1.30 +            SDL_Log("  %d: %s\n", i, SDL_GetAudioDriver(i));
    1.31          }
    1.32 -        SDL_Log("\n");
    1.33 +        SDL_Log("Select a driver with the SDL_AUDIODRIVER environment variable.\n");
    1.34      }
    1.35  
    1.36      SDL_Log("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver());