# HG changeset patch # User Ryan C. Gordon # Date 1000810871 0 # Node ID f2af6266775fbe359abca75560fc417351e3b9d5 # Parent 2888101dcf98d253f2f3432cfddc43a359834cb0 Minor fixes. diff -r 2888101dcf98 -r f2af6266775f playsound/test_sdlsound.c --- a/playsound/test_sdlsound.c Tue Sep 18 11:00:31 2001 +0000 +++ b/playsound/test_sdlsound.c Tue Sep 18 11:01:11 2001 +0000 @@ -65,7 +65,7 @@ const Sound_DecoderInfo **rc = Sound_AvailableDecoders(); const Sound_DecoderInfo **i; - printf("Supported fileformats:\n"); + printf("Supported sound formats:\n"); if (*rc == NULL) printf(" * Apparently, NONE!\n"); else @@ -90,14 +90,11 @@ Uint32 rc = Sound_Decode(sample); if (sample->flags & SOUND_SAMPLEFLAG_EOF) - { - printf("EOF condition in decoding! (this is okay.)\n"); done_flag = 1; - } /* if */ else if (sample->flags & SOUND_SAMPLEFLAG_ERROR) { - printf("Error condition in decoding! (this is bad.)\n"); + printf("Error condition in decoding!\n"); done_flag = 1; } /* else if */ @@ -162,6 +159,7 @@ sdl_desired.callback = test_callback; sdl_desired.userdata = sample; +#if 1 if ( SDL_OpenAudio(&sdl_desired, NULL) < 0 ) { printf("SDL_OpenAudio() failed!\n" @@ -172,9 +170,22 @@ } /* if */ SDL_PauseAudio(0); - while (!done_flag) SDL_Delay(10); + SDL_PauseAudio(1); + +/* + * This just decodes the file, and dumps the decoded waveform to + * stderr. Use with caution. + */ +#else + { + Uint32 rc; + while ((rc = Sound_Decode(sample)) == sample->buffer_size) + fwrite(sample->buffer, rc, 1, stderr); + } +#endif + Sound_FreeSample(sample);