Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Removed ESD cruft from the core...now the driver will use esound if t…
Browse files Browse the repository at this point in the history
…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 bba2160
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 41 deletions.
37 changes: 0 additions & 37 deletions src/audio/SDL_audio.c
Expand Up @@ -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) {
Expand Down
12 changes: 8 additions & 4 deletions src/audio/esd/SDL_esdaudio.c
Expand Up @@ -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;
}
Expand All @@ -139,7 +143,7 @@ Audio_Available(void)
SDL_NAME(esd_close) (connection);
}
UnloadESDLibrary();
return (available);
return available;
}

static void
Expand Down

0 comments on commit bba2160

Please sign in to comment.