Removed ESD cruft from the core...now the driver will use esound if there's SDL-ryan-multiple-audio-device
authorRyan C. Gordon <icculus@icculus.org>
Wed, 04 Oct 2006 22:10:09 +0000
branchSDL-ryan-multiple-audio-device
changeset 38033decf9cdeb63
parent 3802 cef5d927591f
child 3804 b12b7ec0dfcc
Removed ESD cruft from the core...now the driver will use esound if there's
an ESPEAKER variable set for a remote host, or the daemon is already running
on the local host, but it won't spawn it. Hopefully this works out okay.
src/audio/SDL_audio.c
src/audio/esd/SDL_esdaudio.c
     1.1 --- a/src/audio/SDL_audio.c	Wed Oct 04 21:58:48 2006 +0000
     1.2 +++ b/src/audio/SDL_audio.c	Wed Oct 04 22:10:09 2006 +0000
     1.3 @@ -370,48 +370,11 @@
     1.4      SDL_memset(&current_audio, '\0', sizeof (current_audio));
     1.5      SDL_memset(open_devices, '\0', sizeof (open_devices));
     1.6  
     1.7 -    /* !!! FIXME: build a priority list of available drivers... */
     1.8 -
     1.9      /* Select the proper audio driver */
    1.10      if (driver_name == NULL) {
    1.11          driver_name = SDL_getenv("SDL_AUDIODRIVER");
    1.12      }
    1.13  
    1.14 -/* !!! FIXME: move this esound shite into the esound driver... */
    1.15 -#if SDL_AUDIO_DRIVER_ESD
    1.16 -    if ((driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL)) {
    1.17 -        /* Ahem, we know that if ESPEAKER is set, user probably wants
    1.18 -           to use ESD, but don't start it if it's not already running.
    1.19 -           This probably isn't the place to do this, but... Shh! :)
    1.20 -         */
    1.21 -        for (i = 0; bootstrap[i]; ++i) {
    1.22 -            if (SDL_strcasecmp(bootstrap[i]->name, "esd") == 0) {
    1.23 -#ifdef HAVE_PUTENV
    1.24 -                const char *esd_no_spawn;
    1.25 -
    1.26 -                /* Don't start ESD if it's not running */
    1.27 -                esd_no_spawn = getenv("ESD_NO_SPAWN");
    1.28 -                if (esd_no_spawn == NULL) {
    1.29 -                    putenv("ESD_NO_SPAWN=1");
    1.30 -                }
    1.31 -#endif
    1.32 -                if (bootstrap[i]->available()) {
    1.33 -                    SDL_memset(&current_audio, 0, sizeof (current_audio));
    1.34 -                    current_audio.name = bootstrap[i]->name;
    1.35 -                    current_audio.desc = bootstrap[i]->desc;
    1.36 -                    initialized = bootstrap[i]->init(&current_audio.impl);
    1.37 -                    break;
    1.38 -                }
    1.39 -#ifdef HAVE_UNSETENV
    1.40 -                if (esd_no_spawn == NULL) {
    1.41 -                    unsetenv("ESD_NO_SPAWN");
    1.42 -                }
    1.43 -#endif
    1.44 -            }
    1.45 -        }
    1.46 -    }
    1.47 -#endif /* SDL_AUDIO_DRIVER_ESD */
    1.48 -
    1.49      if (!initialized) {
    1.50          if (driver_name != NULL) {
    1.51              for (i = 0; bootstrap[i]; ++i) {
     2.1 --- a/src/audio/esd/SDL_esdaudio.c	Wed Oct 04 21:58:48 2006 +0000
     2.2 +++ b/src/audio/esd/SDL_esdaudio.c	Wed Oct 04 22:10:09 2006 +0000
     2.3 @@ -126,10 +126,14 @@
     2.4  static int
     2.5  Audio_Available(void)
     2.6  {
     2.7 -    int connection;
     2.8 -    int available;
     2.9 +    const char *esd_no_spawn = SDL_getenv("ESD_NO_SPAWN");
    2.10 +    int connection = 0;
    2.11 +    int available = 0;
    2.12  
    2.13 -    available = 0;
    2.14 +    if (esd_no_spawn == NULL) {
    2.15 +        SDL_putenv("ESD_NO_SPAWN=1"); /* Don't start ESD if it's not running */
    2.16 +    }
    2.17 +
    2.18      if (LoadESDLibrary() < 0) {
    2.19          return available;
    2.20      }
    2.21 @@ -139,7 +143,7 @@
    2.22          SDL_NAME(esd_close) (connection);
    2.23      }
    2.24      UnloadESDLibrary();
    2.25 -    return (available);
    2.26 +    return available;
    2.27  }
    2.28  
    2.29  static void