comparison src/audio/SDL_audio.c @ 3803:3decf9cdeb63 SDL-ryan-multiple-audio-device

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.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 04 Oct 2006 22:10:09 +0000
parents cef5d927591f
children b12b7ec0dfcc
comparison
equal deleted inserted replaced
3802:cef5d927591f 3803:3decf9cdeb63
368 } 368 }
369 369
370 SDL_memset(&current_audio, '\0', sizeof (current_audio)); 370 SDL_memset(&current_audio, '\0', sizeof (current_audio));
371 SDL_memset(open_devices, '\0', sizeof (open_devices)); 371 SDL_memset(open_devices, '\0', sizeof (open_devices));
372 372
373 /* !!! FIXME: build a priority list of available drivers... */
374
375 /* Select the proper audio driver */ 373 /* Select the proper audio driver */
376 if (driver_name == NULL) { 374 if (driver_name == NULL) {
377 driver_name = SDL_getenv("SDL_AUDIODRIVER"); 375 driver_name = SDL_getenv("SDL_AUDIODRIVER");
378 } 376 }
379
380 /* !!! FIXME: move this esound shite into the esound driver... */
381 #if SDL_AUDIO_DRIVER_ESD
382 if ((driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL)) {
383 /* Ahem, we know that if ESPEAKER is set, user probably wants
384 to use ESD, but don't start it if it's not already running.
385 This probably isn't the place to do this, but... Shh! :)
386 */
387 for (i = 0; bootstrap[i]; ++i) {
388 if (SDL_strcasecmp(bootstrap[i]->name, "esd") == 0) {
389 #ifdef HAVE_PUTENV
390 const char *esd_no_spawn;
391
392 /* Don't start ESD if it's not running */
393 esd_no_spawn = getenv("ESD_NO_SPAWN");
394 if (esd_no_spawn == NULL) {
395 putenv("ESD_NO_SPAWN=1");
396 }
397 #endif
398 if (bootstrap[i]->available()) {
399 SDL_memset(&current_audio, 0, sizeof (current_audio));
400 current_audio.name = bootstrap[i]->name;
401 current_audio.desc = bootstrap[i]->desc;
402 initialized = bootstrap[i]->init(&current_audio.impl);
403 break;
404 }
405 #ifdef HAVE_UNSETENV
406 if (esd_no_spawn == NULL) {
407 unsetenv("ESD_NO_SPAWN");
408 }
409 #endif
410 }
411 }
412 }
413 #endif /* SDL_AUDIO_DRIVER_ESD */
414 377
415 if (!initialized) { 378 if (!initialized) {
416 if (driver_name != NULL) { 379 if (driver_name != NULL) {
417 for (i = 0; bootstrap[i]; ++i) { 380 for (i = 0; bootstrap[i]; ++i) {
418 if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) { 381 if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) {