Mercurial > sdl-ios-xcode
comparison src/audio/mint/SDL_mintaudio_xbios.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 |
---|---|
59 #else | 59 #else |
60 #define DEBUG_PRINT(what) | 60 #define DEBUG_PRINT(what) |
61 #endif | 61 #endif |
62 | 62 |
63 static unsigned long cookie_snd = 0; | 63 static unsigned long cookie_snd = 0; |
64 | |
65 static int | |
66 MINTXBIOS_Available(void) | |
67 { | |
68 unsigned long dummy = 0; | |
69 /*SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND); */ | |
70 SDL_MintAudio_mint_present = SDL_FALSE; | |
71 | |
72 /* We can't use XBIOS in interrupt with Magic, don't know about thread */ | |
73 if (Getcookie(C_MagX, &dummy) == C_FOUND) { | |
74 return (0); | |
75 } | |
76 | |
77 /* Cookie _SND present ? if not, assume ST machine */ | |
78 if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { | |
79 cookie_snd = SND_PSG; | |
80 } | |
81 | |
82 /* Check if we have 16 bits audio */ | |
83 if ((cookie_snd & SND_16BIT) == 0) { | |
84 DEBUG_PRINT((DEBUG_NAME "no 16 bits sound\n")); | |
85 return (0); | |
86 } | |
87 | |
88 /* Check if audio is lockable */ | |
89 if (Locksnd() != 1) { | |
90 DEBUG_PRINT((DEBUG_NAME "audio locked by other application\n")); | |
91 return (0); | |
92 } | |
93 | |
94 Unlocksnd(); | |
95 | |
96 DEBUG_PRINT((DEBUG_NAME "XBIOS audio available!\n")); | |
97 return (1); | |
98 } | |
99 | 64 |
100 static void | 65 static void |
101 MINTXBIOS_LockDevice(_THIS) | 66 MINTXBIOS_LockDevice(_THIS) |
102 { | 67 { |
103 /* Stop replay */ | 68 /* Stop replay */ |
479 } | 444 } |
480 | 445 |
481 static int | 446 static int |
482 MINTXBIOS_Init(SDL_AudioDriverImpl *impl) | 447 MINTXBIOS_Init(SDL_AudioDriverImpl *impl) |
483 { | 448 { |
449 unsigned long dummy = 0; | |
450 /*SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND); */ | |
451 SDL_MintAudio_mint_present = SDL_FALSE; | |
452 | |
453 /* We can't use XBIOS in interrupt with Magic, don't know about thread */ | |
454 if (Getcookie(C_MagX, &dummy) == C_FOUND) { | |
455 return (0); | |
456 } | |
457 | |
458 /* Cookie _SND present ? if not, assume ST machine */ | |
459 if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { | |
460 cookie_snd = SND_PSG; | |
461 } | |
462 | |
463 /* Check if we have 16 bits audio */ | |
464 if ((cookie_snd & SND_16BIT) == 0) { | |
465 SDL_SetError(DEBUG_NAME "no 16-bit sound"); | |
466 return (0); | |
467 } | |
468 | |
469 /* Check if audio is lockable */ | |
470 if (Locksnd() != 1) { | |
471 SDL_SetError(DEBUG_NAME "audio locked by other application"); | |
472 return (0); | |
473 } | |
474 | |
475 Unlocksnd(); | |
476 | |
477 DEBUG_PRINT((DEBUG_NAME "XBIOS audio available!\n")); | |
478 | |
484 /* Set the function pointers */ | 479 /* Set the function pointers */ |
485 impl->OpenDevice = MINTXBIOS_OpenDevice; | 480 impl->OpenDevice = MINTXBIOS_OpenDevice; |
486 impl->CloseDevice = MINTXBIOS_CloseDevice; | 481 impl->CloseDevice = MINTXBIOS_CloseDevice; |
487 impl->LockAudio = MINTXBIOS_LockAudio; | 482 impl->LockAudio = MINTXBIOS_LockAudio; |
488 impl->UnlockAudio = MINTXBIOS_UnlockAudio; | 483 impl->UnlockAudio = MINTXBIOS_UnlockAudio; |
492 | 487 |
493 return 1; | 488 return 1; |
494 } | 489 } |
495 | 490 |
496 AudioBootStrap MINTAUDIO_XBIOS_bootstrap = { | 491 AudioBootStrap MINTAUDIO_XBIOS_bootstrap = { |
497 MINT_AUDIO_DRIVER_NAME, "MiNT XBIOS audio driver", | 492 MINT_AUDIO_DRIVER_NAME, "MiNT XBIOS audio driver", MINTXBIOS_Init, 0 |
498 MINTXBIOS_Available, MINTXBIOS_Init, 0 | |
499 }; | 493 }; |
500 | 494 |
501 /* vi: set ts=4 sw=4 expandtab: */ | 495 /* vi: set ts=4 sw=4 expandtab: */ |