Makefile.inc: move defaults up, set to sdk 2.5
[vamp-aubio-plugins.git] / plugins / Onset.cpp
index 4494b07..49cd566 100644 (file)
@@ -137,6 +137,7 @@ Onset::getParameterDescriptors() const
     ParameterDescriptor desc;
     desc.identifier = "onsettype";
     desc.name = "Onset Detection Function Type";
+    desc.description = "Type of onset detection function to use";
     desc.minValue = 0;
     desc.maxValue = 7;
     desc.defaultValue = (int)OnsetComplex;
@@ -155,6 +156,7 @@ Onset::getParameterDescriptors() const
     desc = ParameterDescriptor();
     desc.identifier = "peakpickthreshold";
     desc.name = "Peak Picker Threshold";
+    desc.description = "Threshold used for peak picking, the higher the more detections";
     desc.minValue = 0;
     desc.maxValue = 1;
     desc.defaultValue = 0.3;
@@ -164,6 +166,7 @@ Onset::getParameterDescriptors() const
     desc = ParameterDescriptor();
     desc.identifier = "silencethreshold";
     desc.name = "Silence Threshold";
+    desc.description = "Silence threshold, the higher the least detection";
     desc.minValue = -120;
     desc.maxValue = 0;
     desc.defaultValue = -70;
@@ -174,6 +177,7 @@ Onset::getParameterDescriptors() const
     desc = ParameterDescriptor();
     desc.identifier = "minioi";
     desc.name = "Minimum Inter-Onset Interval";
+    desc.description = "Time interval below which two consecutive onsets should be merged";
     desc.minValue = 0;
     desc.maxValue = 40;
     desc.defaultValue = 4;
@@ -232,6 +236,7 @@ Onset::getOutputDescriptors() const
     OutputDescriptor d;
     d.identifier = "onsets";
     d.name = "Onsets";
+    d.description = "List of times at which a note onset was detected";
     d.unit = "";
     d.hasFixedBinCount = true;
     d.binCount = 0;
@@ -239,14 +244,21 @@ Onset::getOutputDescriptors() const
     d.sampleRate = 0;
     list.push_back(d);
 
-    d = OutputDescriptor();
-    d.identifier = "detectionfunction";
-    d.name = "Onset Detection Function";
-    d.unit = "";
-    d.hasFixedBinCount = true;
+    d.identifier = "odf";
+    d.name = "Onset detection function";
+    d.description = "Output of the onset detection function";
+    d.binCount = 1;
+    d.isQuantized = true;
+    d.quantizeStep = 1.0;
+    d.sampleType = OutputDescriptor::OneSamplePerStep;
+    list.push_back(d);
+
+    d.identifier = "todf";
+    d.name = "Thresholded Onset detection function";
+    d.description = "Output of the thresholded onset detection function";
     d.binCount = 1;
-    d.hasKnownExtents = false;
-    d.isQuantized = false;
+    d.isQuantized = true;
+    d.quantizeStep = 1.0;
     d.sampleType = OutputDescriptor::OneSamplePerStep;
     list.push_back(d);
 
@@ -258,7 +270,7 @@ Onset::process(const float *const *inputBuffers,
                Vamp::RealTime timestamp)
 {
     for (size_t i = 0; i < m_stepSize; ++i) {
-        fvec_write_sample(m_ibuf, inputBuffers[0][i], i);
+        fvec_set_sample(m_ibuf, inputBuffers[0][i], i);
     }
 
     aubio_onset_do(m_onsetdet, m_ibuf, m_onset);
@@ -277,13 +289,17 @@ Onset::process(const float *const *inputBuffers,
             m_lastOnset = timestamp;
         }
     }
-/*!!! todo!
-    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);
-*/
+
+    Feature odf;
+    odf.hasTimestamp = false;
+    odf.values.push_back(aubio_onset_get_descriptor(m_onsetdet));
+    returnFeatures[1].push_back(odf);
+
+    Feature todf;
+    todf.hasTimestamp = false;
+    todf.values.push_back(aubio_onset_get_thresholded_descriptor(m_onsetdet));
+    returnFeatures[2].push_back(todf);
+
     return returnFeatures;
 }