Mercurial > sdl-ios-xcode
diff src/audio/paudio/SDL_paudio.c @ 3846:66fb40445587 SDL-ryan-multiple-audio-device
Removed distinction between "available" and "init" in audio backends, since
both had to be checked for success as a pair at the higher level and several
of the Available methods were just always-succeed placeholders anyhow. Now
the availability check is done in the init code, and the higher level tries
all possible drivers until one manages to initialize successfully.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Tue, 17 Oct 2006 09:09:21 +0000 |
parents | ca74a71063ac |
children |
line wrap: on
line diff
--- a/src/audio/paudio/SDL_paudio.c Tue Oct 17 08:04:51 2006 +0000 +++ b/src/audio/paudio/SDL_paudio.c Tue Oct 17 09:09:21 2006 +0000 @@ -126,23 +126,6 @@ return -1; } - -static int -PAUDIO_Available(void) -{ - int fd; - int available; - - available = 0; - fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0); - if (fd >= 0) { - available = 1; - close(fd); - } - return (available); -} - - /* This function waits until it is possible to write a full sound buffer */ static void PAUDIO_WaitDevice(_THIS) @@ -543,6 +526,13 @@ static int PAUDIO_Init(SDL_AudioDriverImpl *impl) { + int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0); + if (fd < 0) { + SDL_SetError("PAUDIO: Couldn't open audio device"); + return 0; + } + close(fd); + /* Set the function pointers */ impl->OpenDevice = DSP_OpenDevice; impl->PlayDevice = DSP_PlayDevice; @@ -555,8 +545,7 @@ } AudioBootStrap PAUDIO_bootstrap = { - PAUDIO_DRIVER_NAME, "AIX Paudio", - PAUDIO_Available, PAUDIO_Init, 0 + PAUDIO_DRIVER_NAME, "AIX Paudio", PAUDIO_Init, 0 }; /* vi: set ts=4 sw=4 expandtab: */