SDL: testaudioinfo: Also test SDL_GetAudioDeviceSpec

From 1ea1a90edb23266b606984596506f826ade66a2d Mon Sep 17 00:00:00 2001
From: Ethan Lee <[EMAIL REDACTED]>
Date: Thu, 29 Sep 2022 10:41:40 -0400
Subject: [PATCH] testaudioinfo: Also test SDL_GetAudioDeviceSpec

---
 test/testaudioinfo.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/test/testaudioinfo.c b/test/testaudioinfo.c
index 6f1e0c75dbf..340aac685c1 100644
--- a/test/testaudioinfo.c
+++ b/test/testaudioinfo.c
@@ -15,6 +15,7 @@
 static void
 print_devices(int iscapture)
 {
+    SDL_AudioSpec spec;
     const char *typestr = ((iscapture) ? "capture" : "output");
     int n = SDL_GetNumAudioDevices(iscapture);
 
@@ -32,6 +33,12 @@ print_devices(int iscapture)
                 SDL_Log("  %d: %s\n", i, name);
             else
                 SDL_Log("  %d Error: %s\n", i, SDL_GetError());
+
+            if (SDL_GetAudioDeviceSpec(i, iscapture, &spec) == 0) {
+                SDL_Log("     Sample Rate: %d\n", spec.freq);
+                SDL_Log("     Channels: %d\n", spec.channels);
+                SDL_Log("     SDL_AudioFormat: %X\n", spec.format);
+            }
         }
         SDL_Log("\n");
     }
@@ -76,9 +83,9 @@ main(int argc, char **argv)
     } else {
         SDL_Log("Default Output Name: %s\n", deviceName != NULL ? deviceName : "unknown");
         SDL_free(deviceName);
-        SDL_Log("Sampling Rate: %d\n", spec.freq);
-        SDL_Log("Number of Channels: %d\n", spec.channels);
-        SDL_Log("Audio Format: %d\n", spec.format);
+        SDL_Log("Sample Rate: %d\n", spec.freq);
+        SDL_Log("Channels: %d\n", spec.channels);
+        SDL_Log("SDL_AudioFormat: %X\n", spec.format);
     }
 
     if (SDL_GetDefaultAudioInfo(&deviceName, &spec, 1) < 0) {
@@ -86,9 +93,9 @@ main(int argc, char **argv)
     } else {
         SDL_Log("Default Capture Name: %s\n", deviceName != NULL ? deviceName : "unknown");
         SDL_free(deviceName);
-        SDL_Log("Sampling Rate: %d\n", spec.freq);
-        SDL_Log("Number of Channels: %d\n", spec.channels);
-        SDL_Log("Audio Format: %d\n", spec.format);
+        SDL_Log("Sample Rate: %d\n", spec.freq);
+        SDL_Log("Channels: %d\n", spec.channels);
+        SDL_Log("SDL_AudioFormat: %X\n", spec.format);
     }