comparison playsound/playsound.c @ 272:0ac181b5adc6

Corrected error reporting to respect Sound_GetError()'s new thread distinctions and not report predecoding errors twice.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 10 Mar 2002 19:03:56 +0000
parents cf8c0bbbdc19
children 06fbb106a554
comparison
equal deleted inserted replaced
271:493dd0173f3d 272:0ac181b5adc6
194 194
195 /* need more. See if there's more to be read... */ 195 /* need more. See if there's more to be read... */
196 if (!(sample->flags & (SOUND_SAMPLEFLAG_ERROR | SOUND_SAMPLEFLAG_EOF))) 196 if (!(sample->flags & (SOUND_SAMPLEFLAG_ERROR | SOUND_SAMPLEFLAG_EOF)))
197 { 197 {
198 decoded_bytes = Sound_Decode(sample); 198 decoded_bytes = Sound_Decode(sample);
199 if (sample->flags & SOUND_SAMPLEFLAG_ERROR)
200 {
201 fprintf(stderr, "Error in decoding sound file!\n"
202 " reason: [%s].\n", Sound_GetError());
203 } /* if */
204
199 decoded_ptr = sample->buffer; 205 decoded_ptr = sample->buffer;
200 return(read_more_data(sample)); /* handle loops conditions. */ 206 return(read_more_data(sample)); /* handle loops conditions. */
201 } /* if */ 207 } /* if */
202 208
203 /* No more to be read from stream, but we may want to loop the sample. */ 209 /* No more to be read from stream, but we may want to loop the sample. */
598 * perhaps SDL needs a way to explicitly wait for device drain? 604 * perhaps SDL needs a way to explicitly wait for device drain?
599 */ 605 */
600 delay = 2 * 1000 * sdl_desired.samples / sdl_desired.freq; 606 delay = 2 * 1000 * sdl_desired.samples / sdl_desired.freq;
601 SDL_Delay(delay); 607 SDL_Delay(delay);
602 608
603 if (sample->flags & SOUND_SAMPLEFLAG_ERROR)
604 {
605 fprintf(stderr, "Error in decoding sound file!\n"
606 " reason: [%s].\n", Sound_GetError());
607 } /* if */
608
609 SDL_CloseAudio(); /* reopen with next sample's format if possible */ 609 SDL_CloseAudio(); /* reopen with next sample's format if possible */
610 Sound_FreeSample(sample); 610 Sound_FreeSample(sample);
611 } /* for */ 611 } /* for */
612 612
613 Sound_Quit(); 613 Sound_Quit();