From: drowe67 Date: Mon, 3 Jun 2013 01:55:39 +0000 (+0000) Subject: added length paramto mksine X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=78359472aa96626704e9d5c2a934e5f20aa6cf1b;p=freetel-svn-tracking.git added length paramto mksine git-svn-id: https://svn.code.sf.net/p/freetel/code@1307 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/unittest/mksine.c b/codec2-dev/unittest/mksine.c index 3e5c551a..932d361a 100644 --- a/codec2-dev/unittest/mksine.c +++ b/codec2-dev/unittest/mksine.c @@ -6,33 +6,37 @@ Creates a file of sine wave samples. */ +#include #include #include #include #define TWO_PI 6.283185307 -#define N 8000 #define FS 8000.0 #define AMP 1000.0 int main(int argc, char *argv[]) { FILE *f; - int i; - float freq; - short buf[N]; + int i,n; + float freq, length; + short *buf; - if (argc != 3) { - printf("usage: %s outputFile frequencyHz\n", argv[0]); + if (argc != 4) { + printf("usage: %s outputFile frequencyHz lengthSecs\n", argv[0]); exit(1); } f = fopen(argv[1] ,"wb"); freq = atof(argv[2]); + length = atof(argv[3]); + n = length*FS; + buf = (short*)malloc(sizeof(short)*n); + assert(buf != NULL); - for(i=0; i