X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=c%2Fgoertzel%2Fgoertzel.c;h=a26975023f6858367a813670f89d4f2bfc865388;hb=4b50f692bc27bd6275483c80720829b126fa2951;hp=f5250a0d11e2740e2a4e9987c0bae928c78796a1;hpb=59934436c41da5c999a065638d2e951a34110b03;p=mirrors%2FPrograms.git diff --git a/c/goertzel/goertzel.c b/c/goertzel/goertzel.c index f5250a0..a269750 100644 --- a/c/goertzel/goertzel.c +++ b/c/goertzel/goertzel.c @@ -76,12 +76,13 @@ int main(int argc, char ** argv) { int samplecount = 4000; int treshold = -1; char noreturn = 0; + char repeat = 1; char integers=0; char verbose=1; int freqs[argc+1]; freqs[0]=-1; int opt; - while ((opt = getopt(argc, argv, "?r:s:f:t:iqn")) != -1) { + while ((opt = getopt(argc, argv, "?r:s:f:t:iqna")) != -1) { switch (opt) { case 'r': samplerate = atoi(optarg); @@ -98,6 +99,9 @@ int main(int argc, char ** argv) { case 'i': integers = 1; break; + case 'a': + repeat = 0; + break; case 'n': noreturn = 1; break; @@ -152,7 +156,7 @@ int main(int argc, char ** argv) { //Set print true if over treshold or if changed to false (print for the last time after going under treshold) printnow = power[i] > treshold; - print = print || printnow || (printlast && !noreturn); + print = !(!repeat && printlast && !(!printnow)) && (print || printnow || (printlast && !noreturn)); } printlast = printnow; fflush(stdout);