comparison src/audio/disk/SDL_diskaudio.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
53 if (devname == NULL) { 53 if (devname == NULL) {
54 devname = DISKDEFAULT_OUTFILE; 54 devname = DISKDEFAULT_OUTFILE;
55 } 55 }
56 } 56 }
57 return devname; 57 return devname;
58 }
59
60 /* Audio driver bootstrap functions */
61 static int
62 DISKAUD_Available(void)
63 {
64 return 1; /* always available. */
65 } 58 }
66 59
67 /* This function waits until it is possible to write a full sound buffer */ 60 /* This function waits until it is possible to write a full sound buffer */
68 static void 61 static void
69 DISKAUD_WaitDevice(_THIS) 62 DISKAUD_WaitDevice(_THIS)
156 } 149 }
157 150
158 static int 151 static int
159 DISKAUD_Init(SDL_AudioDriverImpl *impl) 152 DISKAUD_Init(SDL_AudioDriverImpl *impl)
160 { 153 {
161 /* Initialize all variables that we clean on shutdown */
162 SDL_memset(impl, '\0', sizeof (SDL_AudioDriverImpl));
163
164 /* Set the function pointers */ 154 /* Set the function pointers */
165 impl->OpenDevice = DISKAUD_OpenDevice; 155 impl->OpenDevice = DISKAUD_OpenDevice;
166 impl->WaitDevice = DISKAUD_WaitDevice; 156 impl->WaitDevice = DISKAUD_WaitDevice;
167 impl->PlayDevice = DISKAUD_PlayDevice; 157 impl->PlayDevice = DISKAUD_PlayDevice;
168 impl->GetDeviceBuf = DISKAUD_GetDeviceBuf; 158 impl->GetDeviceBuf = DISKAUD_GetDeviceBuf;
170 160
171 return 1; 161 return 1;
172 } 162 }
173 163
174 AudioBootStrap DISKAUD_bootstrap = { 164 AudioBootStrap DISKAUD_bootstrap = {
175 DISKAUD_DRIVER_NAME, "direct-to-disk audio", 165 DISKAUD_DRIVER_NAME, "direct-to-disk audio", DISKAUD_Init, 1
176 DISKAUD_Available, DISKAUD_Init, 1
177 }; 166 };
178 167
179 /* vi: set ts=4 sw=4 expandtab: */ 168 /* vi: set ts=4 sw=4 expandtab: */