annotate tools/audio_processor_test/null/checker/checker.cpp @ 54:9b4f237e77e1
pygar svn.55
[svn r55] input a bit more parameterized
author |
punk |
date |
Sun, 09 May 2010 12:24:35 -0400 |
parents |
90197e3375e2 |
children |
|
rev |
line source |
rlm@23
|
1 #include <stdio.h>
|
rlm@23
|
2 #include <assert.h>
|
rlm@23
|
3 #include <string.h>
|
rlm@23
|
4 #include "SndfileWavUtil.h"
|
rlm@23
|
5
|
rlm@23
|
6 typedef unsigned short UINT16;
|
rlm@23
|
7
|
rlm@23
|
8 int
|
rlm@23
|
9 main (int argc, char * argv [])
|
rlm@23
|
10 {
|
rlm@23
|
11 const char* inputWavFileName;
|
rlm@23
|
12 const char* outputWavFileName;
|
rlm@23
|
13
|
rlm@23
|
14 FILE *inputPcmFile;
|
rlm@23
|
15 FILE *outputPcmFile;
|
rlm@23
|
16
|
rlm@23
|
17 UINT16 sample;
|
rlm@23
|
18
|
rlm@23
|
19 inputWavFileName = argv[1];
|
rlm@23
|
20 outputWavFileName = argv[2];
|
rlm@23
|
21
|
rlm@23
|
22 // Convert input wav to pcm
|
rlm@23
|
23 generate_pcm(inputWavFileName, "input.pcm");
|
rlm@23
|
24
|
rlm@23
|
25 inputPcmFile = fopen("input.pcm", "r");
|
rlm@23
|
26 outputPcmFile = fopen("output.pcm", "w");
|
rlm@23
|
27
|
rlm@23
|
28 assert(inputPcmFile);
|
rlm@23
|
29 assert(outputPcmFile);
|
rlm@23
|
30
|
rlm@23
|
31 while(fread(&sample, 2, 1, inputPcmFile)) {
|
rlm@23
|
32 assert(fwrite(&sample,2,1,outputPcmFile));
|
rlm@23
|
33 }
|
rlm@23
|
34
|
rlm@23
|
35 fclose(inputPcmFile);
|
rlm@23
|
36 fclose(outputPcmFile);
|
rlm@23
|
37
|
rlm@23
|
38 generate_wav("output.pcm", inputWavFileName, outputWavFileName);
|
rlm@23
|
39
|
rlm@23
|
40 }
|
rlm@23
|
41
|