shithub: aubio

Download patch

ref: 3a8382181e861109214bd7a982e3c9de5f381576
parent: 08d07ce66ec5cad6f812cec5a3cf374a5e0911e7
parent: eadb7f61c8851bdc2438e9f3c7e321d700d9fe50
author: Paul Brossier <piem@piem.org>
date: Wed Jul 1 16:08:51 EDT 2020

Merge branch 'master' into feature/timestretch

--- a/doc/develop.rst
+++ b/doc/develop.rst
@@ -92,7 +92,7 @@
 
 .. literalinclude:: ../tests/src/io/test-source.c
    :language: C
-   :lines: 22-24, 30-32, 34
+   :lines: 24-26, 30, 32-34
 
 .. note::
    With ``samplerate = 0``, ``aubio_source`` will be created with the file's
@@ -102,13 +102,13 @@
 
 .. literalinclude:: ../tests/src/io/test-source.c
    :language: C
-   :lines: 40-44
+   :lines: 41-45
 
 At the end of the processing loop, memory is deallocated:
 
 .. literalinclude:: ../tests/src/io/test-source.c
    :language: C
-   :lines: 55-56
+   :lines: 55-58
 
 See the complete example: :download:`test-source.c
 <../tests/src/io/test-source.c>`.
@@ -126,13 +126,13 @@
 
 .. literalinclude:: ../tests/src/spectral/test-phasevoc.c
    :language: C
-   :lines: 20-37
+   :lines: 27-44
 
 Time to clean up the previously allocated memory:
 
 .. literalinclude:: ../tests/src/spectral/test-phasevoc.c
    :language: C
-   :lines: 39-44
+   :lines: 47-50
 
 See the complete example: :download:`test-phasevoc.c
 <../tests/src/spectral/test-phasevoc.c>`.
--- a/examples/parse_args.h
+++ b/examples/parse_args.h
@@ -25,6 +25,7 @@
 #endif
 
 extern int verbose;
+extern int quiet;
 // input / output
 extern int usejack;
 extern char_t *source_uri;
@@ -127,6 +128,7 @@
       "       -V      --miditap-velo     MIDI velocity; default=65.\n"
 #endif /* defined(PROG_HAS_ONSET) && !defined(PROG_HAS_PITCH) */
 #endif /* defined(PROG_HAS_JACK) && defined(HAVE_JACK) */
+      "       -q      --quiet            be quiet\n"
       "       -v      --verbose          be verbose\n"
       "       -h      --help             display this message\n"
       );
@@ -141,7 +143,7 @@
 parse_args (int argc, char **argv)
 {
 #ifdef HAVE_GETOPT_H
-  const char *options = "hv"
+  const char *options = "hvq"
     "i:r:B:H:"
 #ifdef PROG_HAS_JACK
     "j"
@@ -173,6 +175,7 @@
   struct option long_options[] = {
     {"help",                  0, NULL, 'h'},
     {"verbose",               0, NULL, 'v'},
+    {"quiet",                 0, NULL, 'q'},
     {"input",                 1, NULL, 'i'},
     {"samplerate",            1, NULL, 'r'},
     {"bufsize",               1, NULL, 'B'},
@@ -225,6 +228,9 @@
         return -1;
       case 'v':                /* verbose */
         verbose = 1;
+        break;
+      case 'q':                /* quiet */
+        quiet = 1;
         break;
       case 'j':
         usejack = 1;
--- a/examples/utils.c
+++ b/examples/utils.c
@@ -32,6 +32,7 @@
 #endif /* HAVE_JACK */
 
 int verbose = 0;
+int quiet = 0;
 int usejack = 0;
 // input / output
 char_t *sink_uri = NULL;
@@ -169,7 +170,7 @@
       aubio_source_do (this_source, input_buffer, &read);
       process_func (input_buffer, output_buffer);
       // print to console if verbose or no output given
-      if (verbose || sink_uri == NULL) {
+      if ((verbose || sink_uri == NULL) && !quiet) {
         print();
       }
       if (this_sink) {
--- a/scripts/get_waf.sh
+++ b/scripts/get_waf.sh
@@ -48,7 +48,7 @@
 buildwaf
 popd
 
-cp -prv $WAFBUILDDIR/waf-$WAFVERSION/waf $PWD
+cp -prv $WAFBUILDDIR/waf-$WAFVERSION/waf "$PWD"
 chmod +x waf
 
 cleanup
--- a/src/aubio_priv.h
+++ b/src/aubio_priv.h
@@ -236,14 +236,25 @@
 #define AUBIO_ERR(...)               aubio_log(AUBIO_LOG_ERR, "AUBIO ERROR: " __VA_ARGS__)
 #define AUBIO_INF(...)               aubio_log(AUBIO_LOG_INF, "AUBIO INFO: " __VA_ARGS__)
 #define AUBIO_MSG(...)               aubio_log(AUBIO_LOG_MSG, __VA_ARGS__)
-#define AUBIO_DBG(...)               aubio_log(AUBIO_LOG_DBG, __VA_ARGS__)
+#define _AUBIO_DBG(...)              aubio_log(AUBIO_LOG_DBG, __VA_ARGS__)
 #define AUBIO_WRN(...)               aubio_log(AUBIO_LOG_WRN, "AUBIO WARNING: " __VA_ARGS__)
 #else
 #define AUBIO_ERR(format, args...)   aubio_log(AUBIO_LOG_ERR, "AUBIO ERROR: " format , ##args)
 #define AUBIO_INF(format, args...)   aubio_log(AUBIO_LOG_INF, "AUBIO INFO: " format , ##args)
 #define AUBIO_MSG(format, args...)   aubio_log(AUBIO_LOG_MSG, format , ##args)
-#define AUBIO_DBG(format, args...)   aubio_log(AUBIO_LOG_DBG, format , ##args)
+#define _AUBIO_DBG(format, args...)  aubio_log(AUBIO_LOG_DBG, format , ##args)
 #define AUBIO_WRN(format, args...)   aubio_log(AUBIO_LOG_WRN, "AUBIO WARNING: " format, ##args)
+#endif
+
+#ifdef DEBUG
+#define AUBIO_DBG _AUBIO_DBG
+#else
+// disable debug output
+#ifdef HAVE_C99_VARARGS_MACROS
+#define AUBIO_DBG(...)               {}
+#else
+#define AUBIO_DBG(format, args...)   {}
+#endif
 #endif
 
 #define AUBIO_ERROR   AUBIO_ERR
--- a/wscript
+++ b/wscript
@@ -45,6 +45,9 @@
             help = 'whether to compile with (--build-type=release)' \
                     ' or without (--build-type=debug)' \
                     ' compiler opimizations [default: release]')
+    ctx.add_option('--debug', action = 'store_const',
+            dest = 'build_type', const = 'debug',
+            help = 'build in debug mode (see --build-type)')
     add_option_enable_disable(ctx, 'fftw3f', default = False,
             help_str = 'compile with fftw3f instead of ooura (recommended)',
             help_disable_str = 'do not compile with fftw3f')