From 82ae9d701549a76f5a91c21be480daeab0ab23e7 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Mon, 3 Oct 2016 18:41:10 +0200 Subject: [PATCH] examples/: use PROG_HAS_OUTPUT, add PROG_HAS_SILENCE --- examples/aubionotes.c | 1 + examples/aubioonset.c | 1 + examples/aubiopitch.c | 1 + examples/aubioquiet.c | 1 + examples/aubiotrack.c | 1 + examples/parse_args.h | 18 +++++++++++++++--- 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/examples/aubionotes.c b/examples/aubionotes.c index 75410987..9e8149f2 100644 --- a/examples/aubionotes.c +++ b/examples/aubionotes.c @@ -21,6 +21,7 @@ #include "utils.h" #define PROG_HAS_PITCH 1 #define PROG_HAS_ONSET 1 +#define PROG_HAS_SILENCE 1 #define PROG_HAS_JACK 1 // TODO add PROG_HAS_OUTPUT #include "parse_args.h" diff --git a/examples/aubioonset.c b/examples/aubioonset.c index 69e7bc90..3d00576a 100644 --- a/examples/aubioonset.c +++ b/examples/aubioonset.c @@ -21,6 +21,7 @@ #include "utils.h" #define PROG_HAS_ONSET 1 #define PROG_HAS_OUTPUT 1 +#define PROG_HAS_SILENCE 1 #define PROG_HAS_JACK 1 #include "parse_args.h" diff --git a/examples/aubiopitch.c b/examples/aubiopitch.c index bdda9508..73ed27c8 100644 --- a/examples/aubiopitch.c +++ b/examples/aubiopitch.c @@ -21,6 +21,7 @@ #include "utils.h" #define PROG_HAS_PITCH 1 #define PROG_HAS_OUTPUT 1 +#define PROG_HAS_SILENCE 1 #define PROG_HAS_JACK 1 #include "parse_args.h" diff --git a/examples/aubioquiet.c b/examples/aubioquiet.c index bbe158b4..f62e1ed6 100644 --- a/examples/aubioquiet.c +++ b/examples/aubioquiet.c @@ -19,6 +19,7 @@ */ #include "utils.h" +#define PROG_HAS_SILENCE 1 #include "parse_args.h" sint_t wassilence = 1, issilence; diff --git a/examples/aubiotrack.c b/examples/aubiotrack.c index dcffbffe..f6087b55 100644 --- a/examples/aubiotrack.c +++ b/examples/aubiotrack.c @@ -21,6 +21,7 @@ #include "utils.h" #define PROG_HAS_TEMPO 1 #define PROG_HAS_ONSET 1 +#define PROG_HAS_SILENCE 1 #define PROG_HAS_OUTPUT 1 #define PROG_HAS_JACK 1 #include "parse_args.h" diff --git a/examples/parse_args.h b/examples/parse_args.h index 58423a23..6a3790bb 100644 --- a/examples/parse_args.h +++ b/examples/parse_args.h @@ -100,8 +100,10 @@ void usage (FILE * stream, int exit_code) " -l --pitch-tolerance select pitch tolerance\n" " (yin, yinfft only) a value between 0.1 and 0.7; default=0.3\n" #endif /* PROG_HAS_PITCH */ +#ifdef PROG_HAS_SILENCE " -s --silence select silence threshold\n" " a value in dB, for instance -70, or -100; default=-90\n" +#endif /* PROG_HAS_SILENCE */ " -T --time-format select time values output format\n" " (samples, ms, seconds) default=seconds\n" #ifdef PROG_HAS_OUTPUT @@ -109,10 +111,10 @@ void usage (FILE * stream, int exit_code) " input signal will be added to output synthesis\n" " -f --force-overwrite overwrite output file if needed\n" " do not fail if output file already exists\n" -#endif +#endif /* PROG_HAS_OUTPUT */ #ifdef PROG_HAS_JACK " -j --jack use Jack\n" -#endif +#endif /* PROG_HAS_JACK */ " -v --verbose be verbose\n" " -h --help display this message\n" ); @@ -142,7 +144,13 @@ parse_args (int argc, char **argv) "p:u:l:" #endif /* PROG_HAS_PITCH */ "T:" - "s:mf"; +#ifdef PROG_HAS_SILENCE + "s:" +#endif /* PROG_HAS_SILENCE */ +#ifdef PROG_HAS_OUTPUT + "mf" +#endif /* PROG_HAS_OUTPUT */ + ; int next_option; struct option long_options[] = { {"help", 0, NULL, 'h'}, @@ -166,10 +174,14 @@ parse_args (int argc, char **argv) {"pitch-unit", 1, NULL, 'u'}, {"pitch-tolerance", 1, NULL, 'l'}, #endif /* PROG_HAS_PITCH */ +#ifdef PROG_HAS_SILENCE {"silence", 1, NULL, 's'}, +#endif /* PROG_HAS_SILENCE */ {"time-format", 1, NULL, 'T'}, +#ifdef PROG_HAS_OUTPUT {"mix-input", 0, NULL, 'm'}, {"force-overwrite", 0, NULL, 'f'}, +#endif /* PROG_HAS_OUTPUT */ {NULL, 0, NULL, 0} }; #endif /* HAVE_GETOPT_H */ -- 2.11.0