From c24da7fd60165b3624af04e422a15a0592755b38 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 21 Oct 2017 02:35:44 -0700 Subject: [PATCH] Added some debugging to test float audio with playmus and show the music interfaces being used. --- music.c | 4 ++++ playmus.c | 9 ++++++--- playwave.c | 5 +++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/music.c b/music.c index de65b1e8..44783122 100644 --- a/music.c +++ b/music.c @@ -525,6 +525,10 @@ Mix_Music *Mix_LoadMUSType_RW(SDL_RWops *src, Mix_MusicType type, int freesrc) } music->interface = interface; music->context = context; +#ifdef DEBUG_MUSIC + /* This would be useful to expose via an API */ + SDL_Log("Music playing with %s\n", interface->tag); +#endif return music; } diff --git a/playmus.c b/playmus.c index 21780c60..8ff015dc 100644 --- a/playmus.c +++ b/playmus.c @@ -64,7 +64,7 @@ void CleanUp(int exitcode) void Usage(char *argv0) { - SDL_Log("Usage: %s [-i] [-l] [-8] [-r rate] [-c channels] [-b buffers] [-v N] [-rwops] \n", argv0); + SDL_Log("Usage: %s [-i] [-l] [-8] [-f32] [-r rate] [-c channels] [-b buffers] [-v N] [-rwops] \n", argv0); } void Menu(void) @@ -154,6 +154,9 @@ int main(int argc, char *argv[]) if (strcmp(argv[i], "-8") == 0) { audio_format = AUDIO_U8; } else + if (strcmp(argv[i], "-f32") == 0) { + audio_format = AUDIO_F32; + } else if (strcmp(argv[i], "-rwops") == 0) { rwops = 1; } else { @@ -183,10 +186,10 @@ int main(int argc, char *argv[]) return(2); } else { Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels); - SDL_Log("Opened audio at %d Hz %d bit %s (%s), %d bytes audio buffer\n", audio_rate, + SDL_Log("Opened audio at %d Hz %d bit%s %s %d bytes audio buffer\n", audio_rate, (audio_format&0xFF), + (SDL_AUDIO_ISFLOAT(audio_format) ? " (float)" : ""), (audio_channels > 2) ? "surround" : (audio_channels > 1) ? "stereo" : "mono", - (audio_format&0x1000) ? "BE" : "LE", audio_buffers); } audio_open = 1; diff --git a/playwave.c b/playwave.c index b53ded46..516a8d31 100644 --- a/playwave.c +++ b/playwave.c @@ -289,7 +289,7 @@ static void CleanUp(int exitcode) static void Usage(char *argv0) { - SDL_Log("Usage: %s [-8] [-r rate] [-c channels] [-f] [-F] [-l] [-m] \n", argv0); + SDL_Log("Usage: %s [-8] [-f32] [-r rate] [-c channels] [-f] [-F] [-l] [-m] \n", argv0); } @@ -429,8 +429,9 @@ int main(int argc, char *argv[]) CleanUp(2); } else { Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels); - SDL_Log("Opened audio at %d Hz %d bit %s", audio_rate, + SDL_Log("Opened audio at %d Hz %d bit%s %s", audio_rate, (audio_format&0xFF), + (SDL_AUDIO_ISFLOAT(audio_format) ? " (float)" : ""), (audio_channels > 2) ? "surround" : (audio_channels > 1) ? "stereo" : "mono"); if (loops) {