[examples] add quiet mode for performance measurements
[aubio.git] / examples / utils.c
index 3fb3e0e..01c308d 100644 (file)
@@ -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 @@ void examples_common_process (aubio_process_func_t process_func,
       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) {
@@ -184,7 +185,8 @@ void examples_common_process (aubio_process_func_t process_func,
         total_read, blocks, hop_size, source_uri, samplerate);
 
     del_aubio_source (this_source);
-    del_aubio_sink   (this_sink);
+    if (this_sink)
+      del_aubio_sink   (this_sink);
 
   }
 }