changeset 10:cc2c32349380

Some debugging output, and MP3 and VOC entries, added.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 18 Sep 2001 10:58:03 +0000
parents 2606137cf481
children 5ff1dce70aec
files SDL_sound.c
diffstat 1 files changed, 48 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/SDL_sound.c	Tue Sep 18 10:56:36 2001 +0000
+++ b/SDL_sound.c	Tue Sep 18 10:58:03 2001 +0000
@@ -44,6 +44,10 @@
 
 /* The various decoder drivers... */
 
+#if (defined SOUND_SUPPORTS_MP3)
+extern const Sound_DecoderFunctions  __Sound_DecoderFunctions_MP3;
+#endif
+
 #if (defined SOUND_SUPPORTS_VOC)
 extern const Sound_DecoderFunctions  __Sound_DecoderFunctions_VOC;
 #endif
@@ -54,6 +58,10 @@
 
 static const Sound_DecoderFunctions *decoderFuncs[] =
 {
+#if (defined SOUND_SUPPORTS_MP3)
+    &__Sound_DecoderFunctions_MP3,
+#endif
+
 #if (defined SOUND_SUPPORTS_VOC)
     &__Sound_DecoderFunctions_VOC,
 #endif
@@ -152,7 +160,10 @@
 void Sound_SetError(const char *err)
 {
     if (err != NULL)
+    {
+        _D(("Sound_SetError(\"%s\");\n", err));
         SDL_SetError(err);
+    } /* if */
 } /* Sound_SetError */
 
 
@@ -228,6 +239,30 @@
 } /* alloc_sample */
 
 
+#if (defined DEBUG_CHATTER)
+static __inline__ const char *fmt_to_str(Uint16 fmt)
+{
+    switch(fmt)
+    {
+        case AUDIO_U8:
+            return("U8");
+        case AUDIO_S8:
+            return("S8");
+        case AUDIO_U16LSB:
+            return("U16LSB");
+        case AUDIO_S16LSB:
+            return("S16LSB");
+        case AUDIO_U16MSB:
+            return("U16MSB");
+        case AUDIO_S16MSB:
+            return("S16MSB");
+    } /* switch */
+
+    return("Unknown");
+} /* fmt_to_str */
+#endif
+
+
 /*
  * The bulk of the Sound_NewSample() work is done here...
  *  Ask the specified decoder to handle the data in (rw), and if
@@ -303,6 +338,19 @@
     } /* if */
     samplesList = sample;
 
+    _D(("New sample DESIRED format: %s format, %d rate, %d channels.\n",
+        fmt_to_str(sample->desired.format),
+        sample->desired.rate,
+        sample->desired.channels));
+
+    _D(("New sample ACTUAL format: %s format, %d rate, %d channels.\n",
+        fmt_to_str(sample->actual.format),
+        sample->actual.rate,
+        sample->actual.channels));
+
+    _D(("On-the-fly conversion: %s.\n",
+        internal->sdlcvt.needed ? "ENABLED" : "DISABLED"));
+
     return(1);
 } /* init_sample */