From 1dd6d20d624b823f302c3bd655cc152266a253e4 Mon Sep 17 00:00:00 2001 From: angel Date: Sat, 28 May 2005 15:29:43 +0000 Subject: [PATCH] The wav driver has been simplified. git-svn-id: file:///home/angel/tmp/svn-triptico/ahxm/trunk@598 c87de0a0-a11c-0410-a1e5-866214bc28b2 --- ss_outdev.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ss_outdev.c b/ss_outdev.c index 3715318..f6ddece 100644 --- a/ss_outdev.c +++ b/ss_outdev.c @@ -269,18 +269,22 @@ static int o_wav(int i, char * file, int freq, int n_channels) fwrite("data",1,4,f); fput32(0, f); /* second checkpoint (offset: 40) */ - for(c=0;(n=read(i, ibuf, sizeof(ibuf))) > 0;c++) + n_channels *= sizeof(short int); + + for(c=0;(n=read(i, ibuf, n_channels)) > 0;c++) { - for(m=0;m < n / sizeof(short int);m++) + n /= sizeof(short int); + + for(m=0;m < n;m++) fput16(ibuf[m], f); } /* rewind file and write total size */ fseek(f, 4, SEEK_SET); - fput32((c * n_channels * 2) + 36, f); + fput32((c * n_channels) + 36, f); fseek(f, 40, SEEK_SET); - fput32(c * n_channels * 2, f); + fput32(c * n_channels, f); fclose(f); -- 2.11.4.GIT