shithub: aubio

Download patch

ref: afa21cdc1e09a9e0081f228476bc19ad55f9bccf
parent: 078dad8f5b3484f070d1db29e97aba11c5613f65
author: Paul Brossier <piem@piem.org>
date: Wed Sep 28 11:16:45 EDT 2016

src/pitch/pitch.c: fail on wrong method, warn on wrong unit, improve error messages

--- a/src/pitch/pitch.c
+++ b/src/pitch/pitch.c
@@ -126,9 +126,8 @@
   else if (strcmp (pitch_mode, "default") == 0)
     pitch_type = aubio_pitcht_default;
   else {
-    AUBIO_ERR ("unknown pitch detection method %s, using default.\n",
-        pitch_mode);
-    pitch_type = aubio_pitcht_default;
+    AUBIO_ERR ("pitch: unknown pitch detection method ‘%s’\n", pitch_mode);
+    goto beach;
   }
 
   // check parameters are valid
@@ -283,7 +282,8 @@
   else if (strcmp (pitch_unit, "default") == 0)
     pitch_mode = aubio_pitchm_default;
   else {
-    AUBIO_ERR ("unknown pitch detection unit %s, using default\n", pitch_unit);
+    AUBIO_WRN("pitch: unknown pitch detection unit ‘%s’, using default\n",
+        pitch_unit);
     pitch_mode = aubio_pitchm_default;
     err = AUBIO_FAIL;
   }
@@ -348,7 +348,7 @@
     p->silence = silence;
     return AUBIO_OK;
   } else {
-    AUBIO_ERR("pitch: could not set silence to %.2f", silence);
+    AUBIO_WRN("pitch: could not set silence to %.2f\n", silence);
     return AUBIO_FAIL;
   }
 }