Print the list of audio drivers so you can try each one

This commit is contained in:
Sam Lantinga 2012-11-29 09:48:42 -08:00
parent 8042e18f9a
commit 0b8d0b3c80

View file

@ -78,6 +78,8 @@ poked(int sig)
int
main(int argc, char *argv[])
{
int i;
/* Load the SDL library */
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
@ -106,6 +108,17 @@ main(int argc, char *argv[])
signal(SIGTERM, poked);
#endif /* HAVE_SIGNAL_H */
/* Show the list of available drivers */
printf("Available audio drivers: ");
for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
if (i == 0) {
printf("%s", SDL_GetAudioDriver(i));
} else {
printf(", %s", SDL_GetAudioDriver(i));
}
}
printf("\n");
/* Initialize fillerup() variables */
if (SDL_OpenAudio(&wave.spec, NULL) < 0) {
fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
@ -126,3 +139,5 @@ main(int argc, char *argv[])
SDL_Quit();
return (0);
}
/* vi: set ts=4 sw=4 expandtab: */