Mercurial > sdl-ios-xcode
comparison src/audio/mint/SDL_mintaudio_gsxb.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 |
---|---|
64 /*--- Audio driver functions ---*/ | 64 /*--- Audio driver functions ---*/ |
65 | 65 |
66 /* GSXB callbacks */ | 66 /* GSXB callbacks */ |
67 static void MINTGSXB_GsxbInterrupt(void); | 67 static void MINTGSXB_GsxbInterrupt(void); |
68 static void MINTGSXB_GsxbNullInterrupt(void); | 68 static void MINTGSXB_GsxbNullInterrupt(void); |
69 | |
70 | |
71 static int | |
72 MINTGSXB_Available(void) | |
73 { | |
74 /* Cookie _SND present ? if not, assume ST machine */ | |
75 if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { | |
76 cookie_snd = SND_PSG; | |
77 } | |
78 | |
79 /* Check if we have 16 bits audio */ | |
80 if ((cookie_snd & SND_16BIT) == 0) { | |
81 DEBUG_PRINT((DEBUG_NAME "no 16 bits sound\n")); | |
82 return (0); | |
83 } | |
84 | |
85 /* Cookie GSXB present ? */ | |
86 cookie_gsxb = (Getcookie(C_GSXB, &cookie_gsxb) == C_FOUND); | |
87 | |
88 /* Is it GSXB ? */ | |
89 if (((cookie_snd & SND_GSXB) == 0) || (cookie_gsxb == 0)) { | |
90 DEBUG_PRINT((DEBUG_NAME "no GSXB audio\n")); | |
91 return (0); | |
92 } | |
93 | |
94 /* Check if audio is lockable */ | |
95 if (Locksnd() != 1) { | |
96 DEBUG_PRINT((DEBUG_NAME "audio locked by other application\n")); | |
97 return (0); | |
98 } | |
99 | |
100 Unlocksnd(); | |
101 | |
102 DEBUG_PRINT((DEBUG_NAME "GSXB audio available!\n")); | |
103 return (1); | |
104 } | |
105 | |
106 | 69 |
107 static void | 70 static void |
108 MINTGSXB_LockDevice(_THIS) | 71 MINTGSXB_LockDevice(_THIS) |
109 { | 72 { |
110 /* Stop replay */ | 73 /* Stop replay */ |
425 } | 388 } |
426 | 389 |
427 static int | 390 static int |
428 MINTGSXB_Init(SDL_AudioDriverImpl *impl) | 391 MINTGSXB_Init(SDL_AudioDriverImpl *impl) |
429 { | 392 { |
393 /* Cookie _SND present ? if not, assume ST machine */ | |
394 if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { | |
395 cookie_snd = SND_PSG; | |
396 } | |
397 | |
398 /* Check if we have 16 bits audio */ | |
399 if ((cookie_snd & SND_16BIT) == 0) { | |
400 SDL_SetError(DEBUG_NAME "no 16-bit sound"); | |
401 return 0; | |
402 } | |
403 | |
404 /* Cookie GSXB present ? */ | |
405 cookie_gsxb = (Getcookie(C_GSXB, &cookie_gsxb) == C_FOUND); | |
406 | |
407 /* Is it GSXB ? */ | |
408 if (((cookie_snd & SND_GSXB) == 0) || (cookie_gsxb == 0)) { | |
409 SDL_SetError(DEBUG_NAME "no GSXB audio"); | |
410 return 0; | |
411 } | |
412 | |
413 /* Check if audio is lockable */ | |
414 if (Locksnd() != 1) { | |
415 SDL_SetError(DEBUG_NAME "audio locked by other application"); | |
416 return 0; | |
417 } | |
418 | |
419 Unlocksnd(); | |
420 | |
421 DEBUG_PRINT((DEBUG_NAME "GSXB audio available!\n")); | |
422 | |
430 /* Set the function pointers */ | 423 /* Set the function pointers */ |
431 impl->OpenDevice = MINTGSXB_OpenDevice; | 424 impl->OpenDevice = MINTGSXB_OpenDevice; |
432 impl->CloseDevice = MINTGSXB_CloseDevice; | 425 impl->CloseDevice = MINTGSXB_CloseDevice; |
433 impl->LockAudio = MINTGSXB_LockAudio; | 426 impl->LockAudio = MINTGSXB_LockAudio; |
434 impl->UnlockAudio = MINTGSXB_UnlockAudio; | 427 impl->UnlockAudio = MINTGSXB_UnlockAudio; |
438 | 431 |
439 return 1; | 432 return 1; |
440 } | 433 } |
441 | 434 |
442 AudioBootStrap MINTAUDIO_GSXB_bootstrap = { | 435 AudioBootStrap MINTAUDIO_GSXB_bootstrap = { |
443 MINT_AUDIO_DRIVER_NAME, "MiNT GSXB audio driver", | 436 MINT_AUDIO_DRIVER_NAME, "MiNT GSXB audio driver", MINTGSXB_Init, 0 |
444 MINTGSXB_Available, MINTGSXB_Init, 0 | |
445 }; | 437 }; |
446 | 438 |
447 /* vi: set ts=4 sw=4 expandtab: */ | 439 /* vi: set ts=4 sw=4 expandtab: */ |