From c7611c89afefbf2ab4e36e50a83b8ec5b2e516ae Mon Sep 17 00:00:00 2001 From: Harvie Date: Wed, 1 Aug 2012 05:32:24 +0200 Subject: [PATCH] Arguments renamed --- c/goertzel/dtmf.sh | 2 +- c/goertzel/goertzel.c | 19 ++++++++++++++----- c/goertzel/sleepmon.sh | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/c/goertzel/dtmf.sh b/c/goertzel/dtmf.sh index 2c6547d..80a9d59 100755 --- a/c/goertzel/dtmf.sh +++ b/c/goertzel/dtmf.sh @@ -8,7 +8,7 @@ tresh=10 last=''; -./goertzel -i -q -a -r 8000 -s 400 -t $tresh -f 697 -f 770 -f 852 -f 941 -f 1209 -f 1336 -f 1477 -f 1633 $@ | while read line; do +./goertzel -n -q -l -r 8000 -d 20 -t $tresh -f 697 -f 770 -f 852 -f 941 -f 1209 -f 1336 -f 1477 -f 1633 $@ | while read line; do #echo "$line"; #Get time diff --git a/c/goertzel/goertzel.c b/c/goertzel/goertzel.c index 3dd5885..6b6c5aa 100644 --- a/c/goertzel/goertzel.c +++ b/c/goertzel/goertzel.c @@ -82,12 +82,21 @@ int main(int argc, char ** argv) { int freqs[argc+1]; freqs[0]=-1; int opt; - while ((opt = getopt(argc, argv, "?d:r:s:f:t:iqna")) != -1) { + while ((opt = getopt(argc, argv, "?i:o:a:r:c:d:f:t:nlbq")) != -1) { switch (opt) { + case 'i': + freopen(optarg, "r", stdin); + break; + case 'o': + freopen(optarg, "w", stdout); + break; + case 'a': + freopen(optarg, "a", stdout); + break; case 'r': samplerate = atoi(optarg); break; - case 's': + case 'c': samplecount = atoi(optarg); break; case 'd': @@ -99,13 +108,13 @@ int main(int argc, char ** argv) { case 't': treshold = atoi(optarg); break; - case 'i': + case 'n': integers = 1; break; - case 'a': + case 'l': repeat = 0; break; - case 'n': + case 'b': noreturn = 1; break; case 'q': diff --git a/c/goertzel/sleepmon.sh b/c/goertzel/sleepmon.sh index cb28c71..3b975ba 100755 --- a/c/goertzel/sleepmon.sh +++ b/c/goertzel/sleepmon.sh @@ -21,7 +21,7 @@ screen=false while getopts "s" OPT; do test "$OPT" == 's' && screen=true; done -arecord | ./goertzel -i -q -a -t $tresh -s 2000 | while read line; do +arecord | ./goertzel -n -q -l -t $tresh -d 4 | while read line; do date="$(date +%s)" time="$(echo "$line" | cut -f 1)" level="$(echo "$line" | cut -f 2)" -- 2.30.2