Mercurial > sdl-ios-xcode
changeset 3824:25052dd25810 SDL-ryan-multiple-audio-device
Minor ALSA dynamic loading fix.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sat, 07 Oct 2006 07:23:52 +0000 |
parents | c562b1a12f82 |
children | 76c5a414b996 |
files | src/audio/alsa/SDL_alsa_audio.c |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audio/alsa/SDL_alsa_audio.c Sat Oct 07 06:18:15 2006 +0000 +++ b/src/audio/alsa/SDL_alsa_audio.c Sat Oct 07 07:23:52 2006 +0000 @@ -90,6 +90,12 @@ static int load_alsa_sym(const char *fn, void **addr) { + /* + * !!! FIXME: + * Eventually, this will deal with fallbacks, version changes, and + * missing symbols we can workaround. But for now, it doesn't. + */ + #if HAVE_DLVSYM *addr = dlvsym(alsa_handle, fn, "ALSA_0.9"); if (*addr == NULL) @@ -97,6 +103,7 @@ { *addr = dlsym(alsa_handle, fn); if (*addr == NULL) { + SDL_SetError("dlsym('%s') failed: %s", fn, strerror(errno)); return 0; } } @@ -140,6 +147,7 @@ SDL_ALSA_SYM(snd_pcm_nonblock); return 0; } +#undef SDL_ALSA_SYM #ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC @@ -377,6 +385,7 @@ } SDL_free(this->hidden); this->hidden = NULL; + UnloadALSALibrary(); } } @@ -400,6 +409,11 @@ } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + if (LoadALSALibrary() < 0) { + ALSA_CloseDevice(this); + return 0; + } + /* Open the audio device */ /* Name of device should depend on # channels in spec */ status = ALSA_snd_pcm_open(&pcm_handle,