From: Paul Brossier Date: Tue, 22 Sep 2009 15:37:36 +0000 (+0200) Subject: examples/utils.c: add --bufsize option and short message when option parsing went... X-Git-Tag: bzr2git~332 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=75a0f40927d75377fbab4c5805f05b9c20bd5d84;p=aubio.git examples/utils.c: add --bufsize option and short message when option parsing went wrong (should never happen) --- diff --git a/examples/utils.c b/examples/utils.c index de67627d..515c3e35 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -104,6 +104,7 @@ void usage (FILE * stream, int exit_code) " -t --threshold Set onset detection threshold.\n" " -s --silence Select silence threshold.\n" " -p --pitch Select pitch detection algorithm.\n" + " -B --bufsize Set buffer size.\n" " -H --hopsize Set hopsize.\n" " -a --averaging Use averaging.\n" ); @@ -111,7 +112,7 @@ void usage (FILE * stream, int exit_code) } int parse_args (int argc, char **argv) { - const char *options = "hvjo:i:O:t:s:p:H:a"; + const char *options = "hvjo:i:O:t:s:p:B:H:a"; int next_option; struct option long_options[] = { @@ -125,6 +126,7 @@ int parse_args (int argc, char **argv) { {"silence" , 1, NULL, 's'}, {"pitch" , 1, NULL, 'p'}, {"averaging", 0, NULL, 'a'}, + {"bufsize", 1, NULL, 'B'}, {"hopsize", 1, NULL, 'H'}, {NULL , 0, NULL, 0} }; @@ -211,6 +213,9 @@ int parse_args (int argc, char **argv) { case 'a': averaging = 1; break; + case 'B': + buffer_size = atoi(optarg); + break; case 'H': overlap_size = atoi(optarg); break; @@ -220,6 +225,7 @@ int parse_args (int argc, char **argv) { case -1: /* done with options */ break; default: /*something else unexpected */ + fprintf(stderr, "Error parsing option '%c'\n", next_option); abort (); } }