# HG changeset patch
# User Ryan C. Gordon <icculus@icculus.org>
# Date 1015787036 0
# Node ID 0ac181b5adc68337f3ce6be1f0cd87cace8b02c1
# Parent  493dd0173f3d2bdc4d6603a3236b0712b446e69c
Corrected error reporting to respect Sound_GetError()'s new thread
 distinctions and not report predecoding errors twice.

diff -r 493dd0173f3d -r 0ac181b5adc6 playsound/playsound.c
--- a/playsound/playsound.c	Sun Mar 10 18:35:31 2002 +0000
+++ b/playsound/playsound.c	Sun Mar 10 19:03:56 2002 +0000
@@ -196,6 +196,12 @@
     if (!(sample->flags & (SOUND_SAMPLEFLAG_ERROR | SOUND_SAMPLEFLAG_EOF)))
     {
         decoded_bytes = Sound_Decode(sample);
+        if (sample->flags & SOUND_SAMPLEFLAG_ERROR)
+        {
+            fprintf(stderr, "Error in decoding sound file!\n"
+                            "  reason: [%s].\n", Sound_GetError());
+        } /* if */
+
         decoded_ptr = sample->buffer;
         return(read_more_data(sample));  /* handle loops conditions. */
     } /* if */
@@ -600,12 +606,6 @@
         delay = 2 * 1000 * sdl_desired.samples / sdl_desired.freq;
         SDL_Delay(delay);
 
-        if (sample->flags & SOUND_SAMPLEFLAG_ERROR)
-        {
-            fprintf(stderr, "Error in decoding sound file!\n"
-                            "  reason: [%s].\n", Sound_GetError());
-        } /* if */
-
         SDL_CloseAudio();  /* reopen with next sample's format if possible */
         Sound_FreeSample(sample);
     } /* for */