changeset 13:f2af6266775f

Minor fixes.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 18 Sep 2001 11:01:11 +0000
parents 2888101dcf98
children 41e5e07c5fed
files playsound/test_sdlsound.c
diffstat 1 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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);