changeset 1:8230b03a8060

* Add onset detection function output.
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 15 May 2006 12:56:46 +0000
parents 76761a42d239
children 76c1a7bd0416
files plugins/Onset.cpp
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/Onset.cpp	Thu May 11 14:51:10 2006 +0000
+++ b/plugins/Onset.cpp	Mon May 15 12:56:46 2006 +0000
@@ -31,7 +31,8 @@
     m_onsetdet(0),
     m_onsettype(aubio_onset_mkl),
     m_threshold(0.3),
-    m_silence(-90)
+    m_silence(-90),
+    m_channelCount(1)
 {
 }
 
@@ -215,6 +216,17 @@
     d.sampleType = OutputDescriptor::OneSamplePerStep;
     list.push_back(d);
 
+    d = OutputDescriptor();
+    d.name = "detectionfunction";
+    d.unit = "";
+    d.description = "Onset Detection Function";
+    d.hasFixedBinCount = true;
+    d.binCount = m_channelCount;
+    d.hasKnownExtents = false;
+    d.isQuantized = false;
+    d.sampleType = OutputDescriptor::OneSamplePerStep;
+    list.push_back(d);
+
     return list;
 }
 
@@ -243,6 +255,11 @@
     if (isonset) {
         returnFeatures[0].push_back(Feature());
     }
+    Feature feature;
+    for (size_t j = 0; j < m_channelCount; ++j) {
+        feature.values.push_back(m_onset->data[j][0]);
+    }
+    returnFeatures[1].push_back(feature);
 
     return returnFeatures;
 }