diff SDL_sound.c @ 163:b6d6f994e970

Moved MIDI decoder to end of array. Fixed Sound_SetError() so that it works after the first call. Now makes sure there's really sound data to convert between formats before attempting to do so.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 19 Nov 2001 16:37:22 +0000
parents fa3e593b6a5e
children 9b26ed9eaf04
line wrap: on
line diff
--- a/SDL_sound.c	Mon Nov 19 16:35:12 2001 +0000
+++ b/SDL_sound.c	Mon Nov 19 16:37:22 2001 +0000
@@ -129,14 +129,14 @@
     { 0, &__Sound_DecoderFunctions_SHN },
 #endif
 
+#if (defined SOUND_SUPPORTS_FLAC)
+    { 0, &__Sound_DecoderFunctions_FLAC },
+#endif
+
 #if (defined SOUND_SUPPORTS_MIDI)
     { 0, &__Sound_DecoderFunctions_MIDI },
 #endif
 
-#if (defined SOUND_SUPPORTS_FLAC)
-    { 0, &__Sound_DecoderFunctions_FLAC },
-#endif
-
     { 0, NULL }
 };
 
@@ -244,11 +244,8 @@
  */
 void Sound_SetError(const char *err)
 {
-    if (err != NULL)
-    {
-        SNDDBG(("Sound_SetError(\"%s\");\n", err));
-        SDL_SetError(err);
-    } /* if */
+    SNDDBG(("Sound_SetError(\"%s\");\n", err));
+    SDL_SetError(err);
 } /* Sound_SetError */
 
 
@@ -620,7 +617,7 @@
     sample->flags &= !SOUND_SAMPLEFLAG_EAGAIN;
     retval = internal->funcs->read(sample);
 
-    if (internal->sdlcvt.needed)
+    if (retval > 0 && internal->sdlcvt.needed)
     {
         internal->sdlcvt.len = retval;
         Sound_ConvertAudio(&internal->sdlcvt);