changeset 814:13805b1ca0f7

dump to file
author arpi_esp
date Wed, 16 May 2001 22:23:13 +0000
parents a8c862627dc3
children e34052fd9633
files mp3lib/test.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mp3lib/test.c	Wed May 16 20:07:22 2001 +0000
+++ b/mp3lib/test.c	Wed May 16 22:23:13 2001 +0000
@@ -1,3 +1,5 @@
+
+#define DUMP_PCM
 
 // gcc test.c -I.. -L. -lMP3 -o test -O4
 
@@ -33,6 +35,10 @@
   int total=0;
   unsigned int time1;
   float length;
+#ifdef DUMP_PCM
+  FILE *f=NULL;
+  f=fopen("test.pcm","wb");
+#endif
   
   mp3file=fopen((argc>1)?argv[1]:"test.mp3","rb");
   if(!mp3file){  printf("file not found\n");  exit(1); }
@@ -46,9 +52,12 @@
   MP3_samplerate=MP3_channels=0;
   
   time1=GetTimer();
-  while((len=MP3_DecodeFrame(buffer,-1))>0){
+  while((len=MP3_DecodeFrame(buffer,-1))>0 && total<2000000){
       total+=len;
       // play it
+#ifdef DUMP_PCM
+      fwrite(buffer,len,1,f);
+#endif
       //putchar('.');fflush(stdout);
   }
   time1=GetTimer()-time1;