diff tools/audio_processor_test/null/checker/checker.cpp @ 23:90197e3375e2 pygar svn.24

[svn r24] added testing, but something is wrong with our c++ file.
author rlm
date Wed, 28 Apr 2010 08:19:09 -0400
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/audio_processor_test/null/checker/checker.cpp	Wed Apr 28 08:19:09 2010 -0400
     1.3 @@ -0,0 +1,41 @@
     1.4 +#include <stdio.h>
     1.5 +#include <assert.h>
     1.6 +#include <string.h>
     1.7 +#include "SndfileWavUtil.h"
     1.8 +
     1.9 +typedef unsigned short UINT16;
    1.10 +
    1.11 +int
    1.12 +main (int argc, char * argv [])
    1.13 +{
    1.14 +  const char* inputWavFileName;
    1.15 +  const char* outputWavFileName;
    1.16 +
    1.17 +  FILE *inputPcmFile;
    1.18 +  FILE *outputPcmFile;
    1.19 +
    1.20 +  UINT16 sample;
    1.21 +
    1.22 +  inputWavFileName = argv[1];
    1.23 +  outputWavFileName = argv[2];
    1.24 +
    1.25 +  // Convert input wav to pcm
    1.26 +  generate_pcm(inputWavFileName, "input.pcm");
    1.27 +
    1.28 +  inputPcmFile = fopen("input.pcm", "r");
    1.29 +  outputPcmFile = fopen("output.pcm", "w");
    1.30 +
    1.31 +  assert(inputPcmFile);
    1.32 +  assert(outputPcmFile);
    1.33 +
    1.34 +  while(fread(&sample, 2, 1, inputPcmFile)) {
    1.35 +    assert(fwrite(&sample,2,1,outputPcmFile));
    1.36 +  } 
    1.37 +
    1.38 +  fclose(inputPcmFile);
    1.39 +  fclose(outputPcmFile);
    1.40 +
    1.41 +  generate_wav("output.pcm", inputWavFileName, outputWavFileName);
    1.42 +
    1.43 +}
    1.44 +