shithub: aubio

Download patch

ref: cd77c150fae93e50164a354587589c231b3f4ddc
parent: b4f5967809d2ebb0a69d303048017cfad34927ac
author: Paul Brossier <piem@piem.org>
date: Thu Oct 15 14:49:47 EDT 2009

src/onset/onsetdetection.c: add 'default' method, set it to hfc, set method to default when parsing the string fails

--- a/src/onset/onsetdetection.c
+++ b/src/onset/onsetdetection.c
@@ -133,6 +133,7 @@
         aubio_onset_kl,             /**< Kullback Liebler */
         aubio_onset_mkl,            /**< modified Kullback Liebler */
         aubio_onset_specflux,       /**< spectral flux */
+        aubio_onset_default = aubio_onset_hfc, /**< default mode, set to hfc */
 } aubio_onsetdetection_type;
 
 /** structure to store object state */
@@ -339,9 +340,11 @@
       onset_type = aubio_onset_kl;
   else if (strcmp (onset_mode, "specflux") == 0)
       onset_type = aubio_onset_specflux;
+  else if (strcmp (onset_mode, "default") == 0)
+      onset_type = aubio_onset_default;
   else {
       AUBIO_ERR("unknown onset type.\n");
-      return NULL;
+      onset_type = aubio_onset_default;
   }
   switch(onset_type) {
     /* for both energy and hfc, only fftgrain->norm is required */