Minor ALSA dynamic loading fix. SDL-ryan-multiple-audio-device
authorRyan C. Gordon <icculus@icculus.org>
Sat, 07 Oct 2006 07:23:52 +0000
branchSDL-ryan-multiple-audio-device
changeset 382425052dd25810
parent 3823 c562b1a12f82
child 3825 76c5a414b996
Minor ALSA dynamic loading fix.
src/audio/alsa/SDL_alsa_audio.c
     1.1 --- a/src/audio/alsa/SDL_alsa_audio.c	Sat Oct 07 06:18:15 2006 +0000
     1.2 +++ b/src/audio/alsa/SDL_alsa_audio.c	Sat Oct 07 07:23:52 2006 +0000
     1.3 @@ -90,6 +90,12 @@
     1.4  static int
     1.5  load_alsa_sym(const char *fn, void **addr)
     1.6  {
     1.7 +    /*
     1.8 +     * !!! FIXME:
     1.9 +     * Eventually, this will deal with fallbacks, version changes, and
    1.10 +     *  missing symbols we can workaround. But for now, it doesn't.
    1.11 +     */
    1.12 +
    1.13  #if HAVE_DLVSYM
    1.14      *addr = dlvsym(alsa_handle, fn, "ALSA_0.9");
    1.15      if (*addr == NULL)
    1.16 @@ -97,6 +103,7 @@
    1.17      {
    1.18          *addr = dlsym(alsa_handle, fn);
    1.19          if (*addr == NULL) {
    1.20 +            SDL_SetError("dlsym('%s') failed: %s", fn, strerror(errno));
    1.21              return 0;
    1.22          }
    1.23      }
    1.24 @@ -140,6 +147,7 @@
    1.25      SDL_ALSA_SYM(snd_pcm_nonblock);
    1.26      return 0;
    1.27  }
    1.28 +#undef SDL_ALSA_SYM
    1.29  
    1.30  #ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
    1.31  
    1.32 @@ -377,6 +385,7 @@
    1.33          }
    1.34          SDL_free(this->hidden);
    1.35          this->hidden = NULL;
    1.36 +        UnloadALSALibrary();
    1.37      }
    1.38  }
    1.39  
    1.40 @@ -400,6 +409,11 @@
    1.41      }
    1.42      SDL_memset(this->hidden, 0, (sizeof *this->hidden));
    1.43  
    1.44 +    if (LoadALSALibrary() < 0) {
    1.45 +        ALSA_CloseDevice(this);
    1.46 +        return 0;
    1.47 +    }
    1.48 +
    1.49      /* Open the audio device */
    1.50      /* Name of device should depend on # channels in spec */
    1.51      status = ALSA_snd_pcm_open(&pcm_handle,