forked from Green-Sky/tomato
update sdl Merge commit '644725478f4de0f074a6834e8423ac36dce3974f'
This commit is contained in:
11
external/sdl/SDL/test/testaudioinfo.c
vendored
11
external/sdl/SDL/test/testaudioinfo.c
vendored
@ -19,6 +19,7 @@ print_devices(SDL_bool iscapture)
|
||||
SDL_AudioSpec spec;
|
||||
const char *typestr = ((iscapture) ? "capture" : "output");
|
||||
int n = 0;
|
||||
int frames;
|
||||
SDL_AudioDeviceID *devices = iscapture ? SDL_GetAudioCaptureDevices(&n) : SDL_GetAudioOutputDevices(&n);
|
||||
|
||||
if (devices == NULL) {
|
||||
@ -37,10 +38,11 @@ print_devices(SDL_bool iscapture)
|
||||
SDL_Log(" %d Error: %s\n", i, SDL_GetError());
|
||||
}
|
||||
|
||||
if (SDL_GetAudioDeviceFormat(devices[i], &spec) == 0) {
|
||||
if (SDL_GetAudioDeviceFormat(devices[i], &spec, &frames) == 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(" Buffer Size: %d frames\n", frames);
|
||||
}
|
||||
}
|
||||
SDL_Log("\n");
|
||||
@ -53,6 +55,7 @@ int main(int argc, char **argv)
|
||||
SDL_AudioSpec spec;
|
||||
int i;
|
||||
int n;
|
||||
int frames;
|
||||
SDLTest_CommonState *state;
|
||||
|
||||
/* Initialize test framework */
|
||||
@ -92,22 +95,24 @@ int main(int argc, char **argv)
|
||||
print_devices(SDL_FALSE);
|
||||
print_devices(SDL_TRUE);
|
||||
|
||||
if (SDL_GetAudioDeviceFormat(SDL_AUDIO_DEVICE_DEFAULT_OUTPUT, &spec) < 0) {
|
||||
if (SDL_GetAudioDeviceFormat(SDL_AUDIO_DEVICE_DEFAULT_OUTPUT, &spec, &frames) < 0) {
|
||||
SDL_Log("Error when calling SDL_GetAudioDeviceFormat(default output): %s\n", SDL_GetError());
|
||||
} else {
|
||||
SDL_Log("Default Output Device:\n");
|
||||
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("Buffer Size: %d frames\n", frames);
|
||||
}
|
||||
|
||||
if (SDL_GetAudioDeviceFormat(SDL_AUDIO_DEVICE_DEFAULT_CAPTURE, &spec) < 0) {
|
||||
if (SDL_GetAudioDeviceFormat(SDL_AUDIO_DEVICE_DEFAULT_CAPTURE, &spec, &frames) < 0) {
|
||||
SDL_Log("Error when calling SDL_GetAudioDeviceFormat(default capture): %s\n", SDL_GetError());
|
||||
} else {
|
||||
SDL_Log("Default Capture Device:\n");
|
||||
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("Buffer Size: %d frames\n", frames);
|
||||
}
|
||||
|
||||
SDL_Quit();
|
||||
|
Reference in New Issue
Block a user