diff 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
line wrap: on
line diff
--- a/src/audio/mint/SDL_mintaudio_stfa.c	Tue Oct 17 08:04:51 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio_stfa.c	Tue Oct 17 09:09:21 2006 +0000
@@ -70,31 +70,6 @@
     30720, 32336, 43885, 49152
 };
 
-static int
-MINTSTFA_Available(void)
-{
-    /* Cookie _MCH present ? if not, assume ST machine */
-    if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) {
-        cookie_mch = MCH_ST;
-    }
-
-    /* Cookie _SND present ? if not, assume ST machine */
-    if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
-        cookie_snd = SND_PSG;
-    }
-
-    /* Cookie STFA present ? */
-    if (Getcookie(C_STFA, (long *) &cookie_stfa) != C_FOUND) {
-        DEBUG_PRINT((DEBUG_NAME "no STFA audio\n"));
-        return (0);
-    }
-
-    SDL_MintAudio_stfa = cookie_stfa;
-
-    DEBUG_PRINT((DEBUG_NAME "STFA audio available!\n"));
-    return (1);
-}
-
 static void
 MINTSTFA_LockDevice(_THIS)
 {
@@ -288,6 +263,26 @@
 static int
 MINTSTFA_Init(SDL_AudioDriverImpl *impl)
 {
+    /* Cookie _MCH present ? if not, assume ST machine */
+    if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) {
+        cookie_mch = MCH_ST;
+    }
+
+    /* Cookie _SND present ? if not, assume ST machine */
+    if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
+        cookie_snd = SND_PSG;
+    }
+
+    /* Cookie STFA present ? */
+    if (Getcookie(C_STFA, (long *) &cookie_stfa) != C_FOUND) {
+        SDL_SetError(DEBUG_NAME "no STFA audio");
+        return (0);
+    }
+
+    SDL_MintAudio_stfa = cookie_stfa;
+
+    DEBUG_PRINT((DEBUG_NAME "STFA audio available!\n"));
+
     /* Set the function pointers */
     impl->OpenDevice = MINTSTFA_OpenDevice;
     impl->CloseDevice = MINTSTFA_CloseDevice;
@@ -301,8 +296,7 @@
 }
 
 AudioBootStrap MINTAUDIO_STFA_bootstrap = {
-    MINT_AUDIO_DRIVER_NAME, "MiNT STFA audio driver",
-    MINTSTFA_Available, MINTSTFA_Init, 0
+    MINT_AUDIO_DRIVER_NAME, "MiNT STFA audio driver", MINTSTFA_Init, 0
 };
 
 /* vi: set ts=4 sw=4 expandtab: */