[xiph-cvs] cvs commit: speex/src speexdec.c
Jean-Marc Valin
jm at xiph.org
Sat May 31 22:59:17 PDT 2003
jm 03/06/01 01:59:17
Modified: src Tag: rel-1-0-branch speexdec.c
Log:
playback fixes merged from trunk
Revision Changes Path
No revision
<p>No revision
<p>1.74.2.3 +15 -5 speex/src/speexdec.c
Index: speexdec.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexdec.c,v
retrieving revision 1.74.2.2
retrieving revision 1.74.2.3
diff -u -r1.74.2.2 -r1.74.2.3
--- speexdec.c 31 May 2003 06:00:07 -0000 1.74.2.2
+++ speexdec.c 1 Jun 2003 05:59:17 -0000 1.74.2.3
@@ -136,7 +136,7 @@
exit(1);
}
- format=AFMT_S16_LE;
+ format=AFMT_S16_NE;
if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format)==-1)
{
perror("SNDCTL_DSP_SETFMT");
@@ -401,6 +401,7 @@
int channels=-1;
int rate=0;
int extra_headers;
+ int wav_format=0;
enh_enabled = 1;
@@ -492,6 +493,9 @@
outFile=argv[optind+1];
else
outFile = "";
+ wav_format = strlen(outFile)>=4 && (
+ strcmp(outFile+strlen(outFile)-4,".wav")==0
+ || strcmp(inFile+strlen(inFile)-4,".WAV")==0);
/*Open input file*/
if (strcmp(inFile, "-")==0)
{
@@ -611,8 +615,14 @@
output[i]=-32000.0;
}
/*Convert to short and save to output file*/
- for (i=0;i<frame_size*channels;i++)
- out[i]=(short)le_short((short)floor(.5+output[i]));
+ if (strlen(outFile)!=0)
+ {
+ for (i=0;i<frame_size*channels;i++)
+ out[i]=(short)le_short((short)floor(.5+output[i]));
+ } else {
+ for (i=0;i<frame_size*channels;i++)
+ out[i]=(short)floor(.5+output[i]);
+ }
#if defined WIN32 || defined _WIN32
if (strlen(outFile)==0)
WIN_Play_Samples (out, sizeof(short) * frame_size*channels);
@@ -631,7 +641,7 @@
}
- if (strcmp(outFile+strlen(outFile)-4,".wav")==0 || strcmp(inFile+strlen(inFile)-4,".WAV")==0)
+ if (wav_format)
{
if (fseek(fout,4,SEEK_SET)==0)
{
@@ -663,7 +673,7 @@
ogg_sync_clear(&oy);
#if defined WIN32 || defined _WIN32
- if (fout && strlen(outFile)==0)
+ if (strlen(outFile)==0)
WIN_Audio_close ();
#endif
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list