testaudioinfo: Also test SDL_GetAudioDeviceSpec
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
diff --git a/test/testaudioinfo.c b/test/testaudioinfo.c
index 6f1e0c7..340aac6 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);
}