comparison src/audio/dummy/SDL_dummyaudio.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 9d070c1a45fa
children
comparison
equal deleted inserted replaced
3845:ee5dfa7f7993 3846:66fb40445587
23 */ 23 */
24 #include "SDL_config.h" 24 #include "SDL_config.h"
25 25
26 /* Output audio to nowhere... */ 26 /* Output audio to nowhere... */
27 27
28 #include "SDL_rwops.h"
29 #include "SDL_timer.h"
30 #include "SDL_audio.h" 28 #include "SDL_audio.h"
31 #include "../SDL_audiomem.h"
32 #include "../SDL_audio_c.h" 29 #include "../SDL_audio_c.h"
33 #include "SDL_dummyaudio.h" 30 #include "SDL_dummyaudio.h"
34
35 /* The tag name used by DUMMY audio */
36 #define DUMMYAUD_DRIVER_NAME "dummy"
37
38 static int
39 DUMMYAUD_Available(void)
40 {
41 return 1; /* always available. */
42 }
43 31
44 static int 32 static int
45 DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture) 33 DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture)
46 { 34 {
47 return 1; /* always succeeds. */ 35 return 1; /* always succeeds. */
48 } 36 }
49 37
50
51 static int 38 static int
52 DUMMYAUD_Init(SDL_AudioDriverImpl *impl) 39 DUMMYAUD_Init(SDL_AudioDriverImpl *impl)
53 { 40 {
54 /* Set the function pointers */ 41 /* Set the function pointers */
55 impl->OpenDevice = DUMMYAUD_OpenDevice; 42 impl->OpenDevice = DUMMYAUD_OpenDevice;
56 impl->OnlyHasDefaultOutputDevice = 1; 43 impl->OnlyHasDefaultOutputDevice = 1;
57
58 return 1; 44 return 1;
59 } 45 }
60 46
61 AudioBootStrap DUMMYAUD_bootstrap = { 47 AudioBootStrap DUMMYAUD_bootstrap = {
62 DUMMYAUD_DRIVER_NAME, "SDL dummy audio driver", 48 "dummy", "SDL dummy audio driver", DUMMYAUD_Init, 1
63 DUMMYAUD_Available, DUMMYAUD_Init, 1
64 }; 49 };
65 50
66 /* vi: set ts=4 sw=4 expandtab: */ 51 /* vi: set ts=4 sw=4 expandtab: */