test/loopwave.c
changeset 7639 9406b7dd2f2d
parent 7517 965d57022c01
child 8149 681eb46b8ac4
child 8535 e8ee0708ef5c
     1.1 --- a/test/loopwave.c	Mon Aug 12 22:00:21 2013 -0700
     1.2 +++ b/test/loopwave.c	Wed Aug 14 23:30:10 2013 -0700
     1.3 @@ -80,9 +80,12 @@
     1.4  {
     1.5      int i;
     1.6  
     1.7 +	/* Enable standard application logging */
     1.8 +	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
     1.9 +
    1.10      /* Load the SDL library */
    1.11      if (SDL_Init(SDL_INIT_AUDIO) < 0) {
    1.12 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.13 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.14          return (1);
    1.15      }
    1.16  
    1.17 @@ -91,7 +94,7 @@
    1.18      }
    1.19      /* Load the wave file into memory */
    1.20      if (SDL_LoadWAV(argv[1], &wave.spec, &wave.sound, &wave.soundlen) == NULL) {
    1.21 -        fprintf(stderr, "Couldn't load %s: %s\n", argv[1], SDL_GetError());
    1.22 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", argv[1], SDL_GetError());
    1.23          quit(1);
    1.24      }
    1.25  
    1.26 @@ -109,24 +112,19 @@
    1.27  #endif /* HAVE_SIGNAL_H */
    1.28  
    1.29      /* Show the list of available drivers */
    1.30 -    printf("Available audio drivers: ");
    1.31 +    SDL_Log("Available audio drivers:");
    1.32      for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
    1.33 -        if (i == 0) {
    1.34 -            printf("%s", SDL_GetAudioDriver(i));
    1.35 -        } else {
    1.36 -            printf(", %s", SDL_GetAudioDriver(i));
    1.37 -        }
    1.38 +		SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
    1.39      }
    1.40 -    printf("\n");
    1.41  
    1.42      /* Initialize fillerup() variables */
    1.43      if (SDL_OpenAudio(&wave.spec, NULL) < 0) {
    1.44 -        fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
    1.45 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError());
    1.46          SDL_FreeWAV(wave.sound);
    1.47          quit(2);
    1.48      }
    1.49  
    1.50 -    printf("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
    1.51 +    SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
    1.52  
    1.53      /* Let the audio run */
    1.54      SDL_PauseAudio(0);