diff plugins/Types.cpp @ 33:a2301c902711

Continuing to update for aubio-git (0.4.0?) api
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 09 Jul 2012 17:51:30 +0100
parents 7fd8f7a0b088
children e9eb5753796b
line wrap: on
line diff
--- a/plugins/Types.cpp	Mon Jul 09 15:50:30 2012 +0100
+++ b/plugins/Types.cpp	Mon Jul 09 17:51:30 2012 +0100
@@ -18,26 +18,19 @@
 
 const char *getAubioNameForOnsetType(OnsetType t)
 {
-    switch (t) {
-    case OnsetEnergy: return "energy";
-    case OnsetSpecDiff: return "specdiff";
-    case OnsetHFC: return "hfc";
-    case OnsetComplex: return "complex";
-    case OnsetPhase: return "phase";
-    case OnsetMKL: return "mkl";
-    case OnsetKL: return "kl";
-    case OnsetSpecFlux: return "specflux";
-    }
+    // In the same order as the enum elements in the header
+    static const char *const names[] = {
+        "energy", "specdiff", "hfc", "complex", "phase", "kl", "mkl", "specflux"
+    };
+    return names[(int)t];
 }
 
 const char *getAubioNameForPitchType(PitchType t)
 {
-    switch (t) {
-    case PitchMComb: return "mcomb";
-    case PitchYinFFT: return "yinfft";
-    case PitchYin: return "yin";
-    case PitchSchmitt: return "schmitt";
-    case PitchFComb: return "fcomb";
-    }
+    // In the same order as the enum elements in the header
+    static const char *const names[] = {
+        "yin", "mcomb", "schmitt", "fcomb", "yinfft"
+    };
+    return names[(int)t];
 }