Mercurial > sdl-ios-xcode
comparison src/audio/SDL_audio.c @ 3804:b12b7ec0dfcc SDL-ryan-multiple-audio-device
Removed an if (), which lets this code section be a little less cluttered...
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Wed, 04 Oct 2006 22:16:46 +0000 |
parents | 3decf9cdeb63 |
children | 1485d42cf1a0 |
comparison
equal
deleted
inserted
replaced
3803:3decf9cdeb63 | 3804:b12b7ec0dfcc |
---|---|
373 /* Select the proper audio driver */ | 373 /* Select the proper audio driver */ |
374 if (driver_name == NULL) { | 374 if (driver_name == NULL) { |
375 driver_name = SDL_getenv("SDL_AUDIODRIVER"); | 375 driver_name = SDL_getenv("SDL_AUDIODRIVER"); |
376 } | 376 } |
377 | 377 |
378 if (!initialized) { | 378 if (driver_name != NULL) { |
379 if (driver_name != NULL) { | 379 for (i = 0; bootstrap[i]; ++i) { |
380 for (i = 0; bootstrap[i]; ++i) { | 380 if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) { |
381 if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) { | 381 if (bootstrap[i]->available()) { |
382 if (bootstrap[i]->available()) { | |
383 SDL_memset(¤t_audio, 0, sizeof (current_audio)); | |
384 current_audio.name = bootstrap[i]->name; | |
385 current_audio.desc = bootstrap[i]->desc; | |
386 initialized = bootstrap[i]->init(¤t_audio.impl); | |
387 } | |
388 break; | |
389 } | |
390 } | |
391 } else { | |
392 for (i = 0; (!initialized) && (bootstrap[i]); ++i) { | |
393 if ((!bootstrap[i]->demand) && (bootstrap[i]->available())) { | |
394 SDL_memset(¤t_audio, 0, sizeof (current_audio)); | 382 SDL_memset(¤t_audio, 0, sizeof (current_audio)); |
395 current_audio.name = bootstrap[i]->name; | 383 current_audio.name = bootstrap[i]->name; |
396 current_audio.desc = bootstrap[i]->desc; | 384 current_audio.desc = bootstrap[i]->desc; |
397 initialized = bootstrap[i]->init(¤t_audio.impl); | 385 initialized = bootstrap[i]->init(¤t_audio.impl); |
398 } | 386 } |
387 break; | |
399 } | 388 } |
400 } | 389 } |
401 if (!initialized) { | 390 } else { |
402 if (driver_name) { | 391 for (i = 0; (!initialized) && (bootstrap[i]); ++i) { |
403 SDL_SetError("%s not available", driver_name); | 392 if ((!bootstrap[i]->demand_only) && (bootstrap[i]->available())) { |
404 } else { | 393 SDL_memset(¤t_audio, 0, sizeof (current_audio)); |
405 SDL_SetError("No available audio device"); | 394 current_audio.name = bootstrap[i]->name; |
395 current_audio.desc = bootstrap[i]->desc; | |
396 initialized = bootstrap[i]->init(¤t_audio.impl); | |
406 } | 397 } |
407 SDL_memset(¤t_audio, 0, sizeof (current_audio)); | 398 } |
408 return (-1); /* No driver was available, so fail. */ | 399 } |
409 } | 400 |
401 if (!initialized) { | |
402 if (driver_name) { | |
403 SDL_SetError("%s not available", driver_name); | |
404 } else { | |
405 SDL_SetError("No available audio device"); | |
406 } | |
407 SDL_memset(¤t_audio, 0, sizeof (current_audio)); | |
408 return (-1); /* No driver was available, so fail. */ | |
410 } | 409 } |
411 | 410 |
412 finalize_audio_entry_points(); | 411 finalize_audio_entry_points(); |
413 | 412 |
414 return (0); | 413 return (0); |