From 75a0f40927d75377fbab4c5805f05b9c20bd5d84 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 22 Sep 2009 17:37:36 +0200 Subject: [PATCH] examples/utils.c: add --bufsize option and short message when option parsing went wrong (should never happen) --- examples/utils.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 (); } } -- 2.26.2