Mercurial > sdl-ios-xcode
comparison src/audio/bsd/SDL_bsdaudio.c @ 3846:66fb40445587 SDL-ryan-multiple-audio-device
Removed distinction between "available" and "init" in audio backends, since
both had to be checked for success as a pair at the higher level and several
of the Available methods were just always-succeed placeholders anyhow. Now
the availability check is done in the init code, and the higher level tries
all possible drivers until one manages to initialize successfully.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Tue, 17 Oct 2006 09:09:21 +0000 |
parents | 1f156fd874fa |
children |
comparison
equal
deleted
inserted
replaced
3845:ee5dfa7f7993 | 3846:66fb40445587 |
---|---|
99 static inline void | 99 static inline void |
100 free_device_lists(void) | 100 free_device_lists(void) |
101 { | 101 { |
102 free_device_list(&outputDevices, &outputDeviceCount); | 102 free_device_list(&outputDevices, &outputDeviceCount); |
103 free_device_list(&inputDevices, &inputDeviceCount); | 103 free_device_list(&inputDevices, &inputDeviceCount); |
104 } | |
105 | |
106 | |
107 static int | |
108 BSDAUDIO_Available(void) | |
109 { | |
110 int available = 0; | |
111 build_device_lists(); | |
112 available = ((outputDeviceCount > 0) || (inputDeviceCount > 0)); | |
113 free_device_lists(); | |
114 return available; | |
115 } | 104 } |
116 | 105 |
117 | 106 |
118 static void | 107 static void |
119 BSDAUDIO_Deinitialize(void) | 108 BSDAUDIO_Deinitialize(void) |
441 | 430 |
442 static int | 431 static int |
443 BSDAUDIO_Init(SDL_AudioDriverImpl *impl) | 432 BSDAUDIO_Init(SDL_AudioDriverImpl *impl) |
444 { | 433 { |
445 /* Set the function pointers */ | 434 /* Set the function pointers */ |
446 impl->DetectDevices = DSP_DetectDevices; | 435 impl->DetectDevices = BSDAUDIO_DetectDevices; |
447 impl->GetDeviceName = DSP_GetDeviceName; | 436 impl->GetDeviceName = BSDAUDIO_GetDeviceName; |
448 impl->OpenDevice = DSP_OpenDevice; | 437 impl->OpenDevice = BSDAUDIO_OpenDevice; |
449 impl->PlayDevice = DSP_PlayDevice; | 438 impl->PlayDevice = BSDAUDIO_PlayDevice; |
450 impl->WaitDevice = DSP_WaitDevice; | 439 impl->WaitDevice = BSDAUDIO_WaitDevice; |
451 impl->GetDeviceBuf = DSP_GetDeviceBuf; | 440 impl->GetDeviceBuf = BSDAUDIO_GetDeviceBuf; |
452 impl->CloseDevice = DSP_CloseDevice; | 441 impl->CloseDevice = BSDAUDIO_CloseDevice; |
453 impl->Deinitialize = DSP_Deinitialize; | 442 impl->Deinitialize = BSDAUDIO_Deinitialize; |
454 | 443 |
455 build_device_lists(); | 444 build_device_lists(); |
456 return 1; | 445 return 1; |
457 } | 446 } |
458 | 447 |
459 | 448 |
460 AudioBootStrap BSD_AUDIO_bootstrap = { | 449 AudioBootStrap BSD_AUDIO_bootstrap = { |
461 BSD_AUDIO_DRIVER_NAME, BSD_AUDIO_DRIVER_DESC, | 450 BSD_AUDIO_DRIVER_NAME, BSD_AUDIO_DRIVER_DESC, BSDAUDIO_Init, 0 |
462 BSDAUDIO_Available, BSDAUDIO_Init, 0 | |
463 }; | 451 }; |
464 | 452 |
465 /* vi: set ts=4 sw=4 expandtab: */ | 453 /* vi: set ts=4 sw=4 expandtab: */ |