Mercurial > sdl-ios-xcode
comparison src/audio/SDL_audio.c @ 1909:8f1ab2f7c722
Look at environment variables in SDL_VideoInit() and SDL_AudioInit()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 15 Jul 2006 19:30:18 +0000 |
parents | f132024010be |
children | 542c78b6fb12 |
comparison
equal
deleted
inserted
replaced
1908:e079dafea2bf | 1909:8f1ab2f7c722 |
---|---|
359 } | 359 } |
360 | 360 |
361 /* Select the proper audio driver */ | 361 /* Select the proper audio driver */ |
362 audio = NULL; | 362 audio = NULL; |
363 idx = 0; | 363 idx = 0; |
364 if (driver_name == NULL) { | |
365 driver_name = SDL_getenv("SDL_AUDIODRIVER"); | |
366 } | |
364 #if SDL_AUDIO_DRIVER_ESD | 367 #if SDL_AUDIO_DRIVER_ESD |
365 if ((driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL)) { | 368 if ((driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL)) { |
366 /* Ahem, we know that if ESPEAKER is set, user probably wants | 369 /* Ahem, we know that if ESPEAKER is set, user probably wants |
367 to use ESD, but don't start it if it's not already running. | 370 to use ESD, but don't start it if it's not already running. |
368 This probably isn't the place to do this, but... Shh! :) | 371 This probably isn't the place to do this, but... Shh! :) |
391 } | 394 } |
392 } | 395 } |
393 #endif /* SDL_AUDIO_DRIVER_ESD */ | 396 #endif /* SDL_AUDIO_DRIVER_ESD */ |
394 if (audio == NULL) { | 397 if (audio == NULL) { |
395 if (driver_name != NULL) { | 398 if (driver_name != NULL) { |
396 #if 0 /* This will be replaced with a better driver selection API */ | |
397 if (SDL_strrchr(driver_name, ':') != NULL) { | |
398 idx = atoi(SDL_strrchr(driver_name, ':') + 1); | |
399 } | |
400 #endif | |
401 for (i = 0; bootstrap[i]; ++i) { | 399 for (i = 0; bootstrap[i]; ++i) { |
402 if (SDL_strncmp(bootstrap[i]->name, driver_name, | 400 if (SDL_strncmp(bootstrap[i]->name, driver_name, |
403 SDL_strlen(bootstrap[i]->name)) == 0) { | 401 SDL_strlen(bootstrap[i]->name)) == 0) { |
404 if (bootstrap[i]->available()) { | 402 if (bootstrap[i]->available()) { |
405 audio = bootstrap[i]->create(idx); | 403 audio = bootstrap[i]->create(idx); |
421 if (driver_name) { | 419 if (driver_name) { |
422 SDL_SetError("%s not available", driver_name); | 420 SDL_SetError("%s not available", driver_name); |
423 } else { | 421 } else { |
424 SDL_SetError("No available audio device"); | 422 SDL_SetError("No available audio device"); |
425 } | 423 } |
426 #if 0 /* Don't fail SDL_Init() if audio isn't available. | 424 #if 0 |
427 SDL_OpenAudio() will handle it at that point. *sigh* | 425 /* Don't fail SDL_Init() if audio isn't available. |
428 */ | 426 SDL_OpenAudio() will handle it at that point. *sigh* |
427 */ | |
429 return (-1); | 428 return (-1); |
430 #endif | 429 #endif |
431 } | 430 } |
432 } | 431 } |
433 current_audio = audio; | 432 current_audio = audio; |