summaryrefslogtreecommitdiffstats
path: root/mp3lib/test2.c
diff options
context:
space:
mode:
Diffstat (limited to 'mp3lib/test2.c')
-rw-r--r--mp3lib/test2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mp3lib/test2.c b/mp3lib/test2.c
index 0b6a7cbb25..f9bcfc073f 100644
--- a/mp3lib/test2.c
+++ b/mp3lib/test2.c
@@ -26,10 +26,10 @@ int main(int argc,char* argv[]){
int total=0;
int r;
int audio_fd;
-
+
mp3file=fopen((argc>1)?argv[1]:"test.mp3","rb");
if(!mp3file){ printf("file not found\n"); exit(1); }
-
+
GetCpuCaps(&gCpuCaps);
// MPEG Audio:
@@ -40,19 +40,19 @@ int main(int argc,char* argv[]){
#endif
MP3_samplerate=MP3_channels=0;
len=MP3_DecodeFrame(buffer,-1);
-
+
audio_fd=open("/dev/dsp", O_WRONLY);
if(audio_fd<0){ printf("Can't open audio device\n");exit(1); }
r=AFMT_S16_LE;ioctl (audio_fd, SNDCTL_DSP_SETFMT, &r);
r=MP3_channels-1;ioctl (audio_fd, SNDCTL_DSP_STEREO, &r);
r=MP3_samplerate;ioctl (audio_fd, SNDCTL_DSP_SPEED, &r);
printf("audio_setup: using %d Hz samplerate (requested: %d)\n",r,MP3_samplerate);
-
+
while(1){
int len2;
if(len==0) len=MP3_DecodeFrame(buffer,-1);
if(len<=0) break; // EOF
-
+
// play it
len2=write(audio_fd,buffer,len);
if(len2<0) break; // ERROR?
@@ -63,7 +63,7 @@ int main(int argc,char* argv[]){
putchar('!');fflush(stdout);
}
}
-
+
fclose(mp3file);
return 0;
}