diff src/audio/mint/SDL_mintaudio_dma8.c @ 2005:45af7d69f8eb

MiNT audio driver cleanups for clamping types and channels to supported values. int32 support now available in one instance.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 01 Sep 2006 06:32:54 +0000
parents c121d94672cb
children d48ead2d2ba5
line wrap: on
line diff
--- a/src/audio/mint/SDL_mintaudio_dma8.c	Fri Sep 01 06:01:03 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio_dma8.c	Fri Sep 01 06:32:54 2006 +0000
@@ -218,12 +218,17 @@
     int i, masterprediv, sfreq;
     unsigned long masterclock;
 
-    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff));
-    DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
-    DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
+    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
+    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
+    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
+    DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
     DEBUG_PRINT(("channels=%d, ", spec->channels));
     DEBUG_PRINT(("freq=%d\n", spec->freq));
 
+    if (spec->channels > 2) {
+        spec->channels = 2;  /* no more than stereo! */
+    }
+
     /* Check formats available */
     spec->format = AUDIO_S8;
 
@@ -269,9 +274,10 @@
     MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
     spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
 
-    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff));
-    DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
-    DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
+    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
+    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
+    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
+    DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
     DEBUG_PRINT(("channels=%d, ", spec->channels));
     DEBUG_PRINT(("freq=%d\n", spec->freq));