Added some debugging to test float audio with playmus and show the music interfaces being used.
authorSam Lantinga <slouken@libsdl.org>
Sat, 21 Oct 2017 02:35:44 -0700
changeset 80298ee7bc3833a
parent 801 46acd70caa6a
child 803 d1deb5a4c3f5
Added some debugging to test float audio with playmus and show the music interfaces being used.
music.c
playmus.c
playwave.c
     1.1 --- a/music.c	Sat Oct 21 02:10:33 2017 -0700
     1.2 +++ b/music.c	Sat Oct 21 02:35:44 2017 -0700
     1.3 @@ -525,6 +525,10 @@
     1.4              }
     1.5              music->interface = interface;
     1.6              music->context = context;
     1.7 +#ifdef DEBUG_MUSIC
     1.8 +            /* This would be useful to expose via an API */
     1.9 +            SDL_Log("Music playing with %s\n", interface->tag);
    1.10 +#endif
    1.11              return music;
    1.12          }
    1.13  
     2.1 --- a/playmus.c	Sat Oct 21 02:10:33 2017 -0700
     2.2 +++ b/playmus.c	Sat Oct 21 02:35:44 2017 -0700
     2.3 @@ -64,7 +64,7 @@
     2.4  
     2.5  void Usage(char *argv0)
     2.6  {
     2.7 -    SDL_Log("Usage: %s [-i] [-l] [-8] [-r rate] [-c channels] [-b buffers] [-v N] [-rwops] <musicfile>\n", argv0);
     2.8 +    SDL_Log("Usage: %s [-i] [-l] [-8] [-f32] [-r rate] [-c channels] [-b buffers] [-v N] [-rwops] <musicfile>\n", argv0);
     2.9  }
    2.10  
    2.11  void Menu(void)
    2.12 @@ -154,6 +154,9 @@
    2.13          if (strcmp(argv[i], "-8") == 0) {
    2.14              audio_format = AUDIO_U8;
    2.15          } else
    2.16 +        if (strcmp(argv[i], "-f32") == 0) {
    2.17 +            audio_format = AUDIO_F32;
    2.18 +        } else
    2.19          if (strcmp(argv[i], "-rwops") == 0) {
    2.20              rwops = 1;
    2.21          } else {
    2.22 @@ -183,10 +186,10 @@
    2.23          return(2);
    2.24      } else {
    2.25          Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
    2.26 -        SDL_Log("Opened audio at %d Hz %d bit %s (%s), %d bytes audio buffer\n", audio_rate,
    2.27 +        SDL_Log("Opened audio at %d Hz %d bit%s %s %d bytes audio buffer\n", audio_rate,
    2.28              (audio_format&0xFF),
    2.29 +            (SDL_AUDIO_ISFLOAT(audio_format) ? " (float)" : ""),
    2.30              (audio_channels > 2) ? "surround" : (audio_channels > 1) ? "stereo" : "mono",
    2.31 -            (audio_format&0x1000) ? "BE" : "LE",
    2.32              audio_buffers);
    2.33      }
    2.34      audio_open = 1;
     3.1 --- a/playwave.c	Sat Oct 21 02:10:33 2017 -0700
     3.2 +++ b/playwave.c	Sat Oct 21 02:35:44 2017 -0700
     3.3 @@ -289,7 +289,7 @@
     3.4  
     3.5  static void Usage(char *argv0)
     3.6  {
     3.7 -    SDL_Log("Usage: %s [-8] [-r rate] [-c channels] [-f] [-F] [-l] [-m] <wavefile>\n", argv0);
     3.8 +    SDL_Log("Usage: %s [-8] [-f32] [-r rate] [-c channels] [-f] [-F] [-l] [-m] <wavefile>\n", argv0);
     3.9  }
    3.10  
    3.11  
    3.12 @@ -429,8 +429,9 @@
    3.13          CleanUp(2);
    3.14      } else {
    3.15          Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
    3.16 -        SDL_Log("Opened audio at %d Hz %d bit %s", audio_rate,
    3.17 +        SDL_Log("Opened audio at %d Hz %d bit%s %s", audio_rate,
    3.18              (audio_format&0xFF),
    3.19 +            (SDL_AUDIO_ISFLOAT(audio_format) ? " (float)" : ""),
    3.20              (audio_channels > 2) ? "surround" :
    3.21              (audio_channels > 1) ? "stereo" : "mono");
    3.22          if (loops) {