From: Harvie Date: Wed, 1 Aug 2012 03:23:04 +0000 (+0200) Subject: Added parameter -d to set buffer size proportional to sample rate X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=f5c8b03d78139ab03ce177e4e311f16fc5123a46;p=mirrors%2FPrograms.git Added parameter -d to set buffer size proportional to sample rate --- diff --git a/c/goertzel/goertzel.c b/c/goertzel/goertzel.c index a269750..3dd5885 100644 --- a/c/goertzel/goertzel.c +++ b/c/goertzel/goertzel.c @@ -82,7 +82,7 @@ int main(int argc, char ** argv) { int freqs[argc+1]; freqs[0]=-1; int opt; - while ((opt = getopt(argc, argv, "?r:s:f:t:iqna")) != -1) { + while ((opt = getopt(argc, argv, "?d:r:s:f:t:iqna")) != -1) { switch (opt) { case 'r': samplerate = atoi(optarg); @@ -90,6 +90,9 @@ int main(int argc, char ** argv) { case 's': samplecount = atoi(optarg); break; + case 'd': + samplecount = samplerate/atoi(optarg); + break; case 'f': addfreq(freqs, atoi(optarg)); break;