testaudioinfo: Also test SDL_GetAudioDeviceSpec
parent
40893821f2
commit
1ea1a90edb
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue