Mercurial > sdl-ios-xcode
comparison src/audio/mint/SDL_mintaudio_stfa.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 |
---|---|
68 9830, 10971, 12538, 14985, | 68 9830, 10971, 12538, 14985, |
69 16384, 19819, 21943, 24576, | 69 16384, 19819, 21943, 24576, |
70 30720, 32336, 43885, 49152 | 70 30720, 32336, 43885, 49152 |
71 }; | 71 }; |
72 | 72 |
73 static int | |
74 MINTSTFA_Available(void) | |
75 { | |
76 /* Cookie _MCH present ? if not, assume ST machine */ | |
77 if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) { | |
78 cookie_mch = MCH_ST; | |
79 } | |
80 | |
81 /* Cookie _SND present ? if not, assume ST machine */ | |
82 if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { | |
83 cookie_snd = SND_PSG; | |
84 } | |
85 | |
86 /* Cookie STFA present ? */ | |
87 if (Getcookie(C_STFA, (long *) &cookie_stfa) != C_FOUND) { | |
88 DEBUG_PRINT((DEBUG_NAME "no STFA audio\n")); | |
89 return (0); | |
90 } | |
91 | |
92 SDL_MintAudio_stfa = cookie_stfa; | |
93 | |
94 DEBUG_PRINT((DEBUG_NAME "STFA audio available!\n")); | |
95 return (1); | |
96 } | |
97 | |
98 static void | 73 static void |
99 MINTSTFA_LockDevice(_THIS) | 74 MINTSTFA_LockDevice(_THIS) |
100 { | 75 { |
101 /* Stop replay */ | 76 /* Stop replay */ |
102 void *oldpile = (void *) Super(0); | 77 void *oldpile = (void *) Super(0); |
286 | 261 |
287 | 262 |
288 static int | 263 static int |
289 MINTSTFA_Init(SDL_AudioDriverImpl *impl) | 264 MINTSTFA_Init(SDL_AudioDriverImpl *impl) |
290 { | 265 { |
266 /* Cookie _MCH present ? if not, assume ST machine */ | |
267 if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) { | |
268 cookie_mch = MCH_ST; | |
269 } | |
270 | |
271 /* Cookie _SND present ? if not, assume ST machine */ | |
272 if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { | |
273 cookie_snd = SND_PSG; | |
274 } | |
275 | |
276 /* Cookie STFA present ? */ | |
277 if (Getcookie(C_STFA, (long *) &cookie_stfa) != C_FOUND) { | |
278 SDL_SetError(DEBUG_NAME "no STFA audio"); | |
279 return (0); | |
280 } | |
281 | |
282 SDL_MintAudio_stfa = cookie_stfa; | |
283 | |
284 DEBUG_PRINT((DEBUG_NAME "STFA audio available!\n")); | |
285 | |
291 /* Set the function pointers */ | 286 /* Set the function pointers */ |
292 impl->OpenDevice = MINTSTFA_OpenDevice; | 287 impl->OpenDevice = MINTSTFA_OpenDevice; |
293 impl->CloseDevice = MINTSTFA_CloseDevice; | 288 impl->CloseDevice = MINTSTFA_CloseDevice; |
294 impl->LockAudio = MINTSTFA_LockAudio; | 289 impl->LockAudio = MINTSTFA_LockAudio; |
295 impl->UnlockAudio = MINTSTFA_UnlockAudio; | 290 impl->UnlockAudio = MINTSTFA_UnlockAudio; |
299 | 294 |
300 return 1; | 295 return 1; |
301 } | 296 } |
302 | 297 |
303 AudioBootStrap MINTAUDIO_STFA_bootstrap = { | 298 AudioBootStrap MINTAUDIO_STFA_bootstrap = { |
304 MINT_AUDIO_DRIVER_NAME, "MiNT STFA audio driver", | 299 MINT_AUDIO_DRIVER_NAME, "MiNT STFA audio driver", MINTSTFA_Init, 0 |
305 MINTSTFA_Available, MINTSTFA_Init, 0 | |
306 }; | 300 }; |
307 | 301 |
308 /* vi: set ts=4 sw=4 expandtab: */ | 302 /* vi: set ts=4 sw=4 expandtab: */ |