examples/aubionotes.c: add warning for missing options
[aubio.git] / examples / aubionotes.c
index 9e8149f..f5f3f1e 100644 (file)
@@ -50,6 +50,8 @@ void process_print (void)
 }
 
 int main(int argc, char **argv) {
+  int ret = 0;
+
   examples_common_init(argc,argv);
 
   verbmsg ("using source: %s at %dHz\n", source_uri, samplerate);
@@ -65,15 +67,33 @@ int main(int argc, char **argv) {
   verbmsg ("tolerance: %f\n", pitch_tolerance);
 
   notes = new_aubio_notes ("default", buffer_size, hop_size, samplerate);
+  if (notes == NULL) { ret = 1; goto beach; }
+
+  if (onset_minioi != 0.) {
+    errmsg ("warning: onset minioio not supported yet\n");
+    //aubio_onset_set_minioi_ms(aubio_notes_get_aubio_onset(o), onset_minioi);
+  }
+  if (onset_threshold != 0.) {
+    errmsg ("warning: onset threshold not supported yet\n");
+    //aubio_onset_set_threshold(aubio_notes_get_aubio_onset(o), onset_threshold);
+  }
+  if (silence_threshold != -90.) {
+    if (aubio_notes_set_silence (notes, silence_threshold) != 0) {
+      errmsg ("failed setting notes silence threshold to %.2f\n",
+          silence_threshold);
+    }
+  }
 
   examples_common_process((aubio_process_func_t)process_block, process_print);
 
   // send a last note off
-  send_noteon (lastmidi, 0);
+  if (usejack) {
+    send_noteon (lastmidi, 0);
+  }
 
   del_aubio_notes (notes);
 
+beach:
   examples_common_del();
-  return 0;
+  return ret;
 }
-