Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Removed ESD cruft from the core...now the driver will use esound if t…

…here'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.
  • Loading branch information
icculus committed Oct 4, 2006
1 parent 46bd258 commit bba21600ff72335de7bec9476585069d5ab58ed2
Showing with 8 additions and 41 deletions.
  1. +0 −37 src/audio/SDL_audio.c
  2. +8 −4 src/audio/esd/SDL_esdaudio.c
@@ -370,48 +370,11 @@ SDL_AudioInit(const char *driver_name)
SDL_memset(&current_audio, '\0', sizeof (current_audio));
SDL_memset(open_devices, '\0', sizeof (open_devices));

/* !!! FIXME: build a priority list of available drivers... */

/* Select the proper audio driver */
if (driver_name == NULL) {
driver_name = SDL_getenv("SDL_AUDIODRIVER");
}

/* !!! FIXME: move this esound shite into the esound driver... */
#if SDL_AUDIO_DRIVER_ESD
if ((driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL)) {
/* Ahem, we know that if ESPEAKER is set, user probably wants
to use ESD, but don't start it if it's not already running.
This probably isn't the place to do this, but... Shh! :)
*/
for (i = 0; bootstrap[i]; ++i) {
if (SDL_strcasecmp(bootstrap[i]->name, "esd") == 0) {
#ifdef HAVE_PUTENV
const char *esd_no_spawn;

/* Don't start ESD if it's not running */
esd_no_spawn = getenv("ESD_NO_SPAWN");
if (esd_no_spawn == NULL) {
putenv("ESD_NO_SPAWN=1");
}
#endif
if (bootstrap[i]->available()) {
SDL_memset(&current_audio, 0, sizeof (current_audio));
current_audio.name = bootstrap[i]->name;
current_audio.desc = bootstrap[i]->desc;
initialized = bootstrap[i]->init(&current_audio.impl);
break;
}
#ifdef HAVE_UNSETENV
if (esd_no_spawn == NULL) {
unsetenv("ESD_NO_SPAWN");
}
#endif
}
}
}
#endif /* SDL_AUDIO_DRIVER_ESD */

if (!initialized) {
if (driver_name != NULL) {
for (i = 0; bootstrap[i]; ++i) {
@@ -126,10 +126,14 @@ LoadESDLibrary(void)
static int
Audio_Available(void)
{
int connection;
int available;
const char *esd_no_spawn = SDL_getenv("ESD_NO_SPAWN");
int connection = 0;
int available = 0;

if (esd_no_spawn == NULL) {
SDL_putenv("ESD_NO_SPAWN=1"); /* Don't start ESD if it's not running */
}

available = 0;
if (LoadESDLibrary() < 0) {
return available;
}
@@ -139,7 +143,7 @@ Audio_Available(void)
SDL_NAME(esd_close) (connection);
}
UnloadESDLibrary();
return (available);
return available;
}

static void

0 comments on commit bba2160

Please sign in to comment.