diff options
author | Robin Watts <robin@xiph.org> | 2010-06-20 22:19:44 +0000 |
---|---|---|
committer | Robin Watts <robin@xiph.org> | 2010-06-20 22:19:44 +0000 |
commit | 3175ff964c7d85d070df823189997f6b753cfef7 (patch) | |
tree | a24f62f711fd597302407d9e1b1243a7e9aee275 | |
parent | 1194410e25ac628cdf731266eb96c478624454f7 (diff) | |
download | tremor-tremolo.tar.gz |
Update testtremor app to have compile time option to output in (almost legal)tremolo
WAV format.
git-svn-id: https://svn.xiph.org/branches/lowmem-branch/Tremolo@17299 0101bb08-14d6-0310-b084-bc0e0c8e3800
-rw-r--r-- | testtremor.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/testtremor.c b/testtremor.c index 734b084..3f19f6a 100644 --- a/testtremor.c +++ b/testtremor.c @@ -28,6 +28,8 @@ //#define PROFILE +#define WAV_FORMAT + #ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */ #include <io.h> #include <fcntl.h> @@ -298,6 +300,24 @@ int main(int argc, char *argv[]){ Output("Failed to open '%s' for output\n", argv[2]); exit(EXIT_FAILURE); } +#ifdef WAV_FORMAT + { unsigned int rate = 44100, channels=2, bps=16, drate, dblock; + fprintf(out, "RIFF%c%c%c%c",0,0,0,0); /* RIFF, chunksize */ + fprintf(out, "WAVEfmt %c%c%c%c",16,0,0,0); /* WAVEfmt, chunksize */; + fprintf(out, "%c%c%c%c", 1,0, channels,0); /* fmt(PCM), channels) */ + fprintf(out, "%c%c%c%c", /* Sampling rate (blocks per second) */ + rate,rate>>8,rate>>16,rate>>24); + drate = (bps>>3)*channels*rate; + fprintf(out, "%c%c%c%c", /* data rate */ + drate,drate>>8,drate>>16,drate>>24); + dblock = (bps>>3)*channels; + fprintf(out, "%c%c", /* data block size(bytes) */ + dblock,dblock>>8); + fprintf(out, "%c%c", /* bps */ + bps,bps>>8); + fprintf(out, "data%c%c%c%c",0,0,0,0); /* sample header */ + } +#endif } if (argc >= 4) @@ -312,6 +332,24 @@ int main(int argc, char *argv[]){ Output("Failed to open '%s' as output reference file\n", argv[3]); exit(EXIT_FAILURE); } +#ifdef WAV_FORMAT + { unsigned int rate = 44100, channels=2, bps=16, drate, dblock; + fprintf(out, "RIFF%c%c%c%c",0,0,0,0); /* RIFF, chunksize */ + fprintf(out, "WAVEfmt %c%c%c%c",16,0,0,0); /* WAVEfmt, chunksize */; + fprintf(out, "%c%c%c%c", 1,0, channels,0); /* fmt(PCM), channels) */ + fprintf(out, "%c%c%c%c", /* Sampling rate (blocks per second) */ + rate,rate>>8,rate>>16,rate>>24); + drate = (bps>>3)*channels*rate; + fprintf(out, "%c%c%c%c", /* data rate */ + drate,drate>>8,drate>>16,drate>>24); + dblock = (bps>>3)*channels; + fprintf(out, "%c%c", /* data block size(bytes) */ + dblock,dblock>>8); + fprintf(out, "%c%c", /* bps */ + bps,bps>>8); + fprintf(out, "data%c%c%c%c",0,0,0,0); /* sample header */ + } +#endif } } |