Adjust includes for subrepo aubio
[vamp-aubio-plugins.git] / plugins / Onset.cpp
index 8d91587..e5875c5 100644 (file)
@@ -91,27 +91,30 @@ Onset::initialise(size_t channels, size_t stepSize, size_t blockSize)
     m_ibuf = new_fvec(stepSize);
     m_onset = new_fvec(1);
 
+    reset();
+
+    return true;
+}
+
+void
+Onset::reset()
+{
+    if (m_onsetdet) del_aubio_onset(m_onsetdet);
+
     m_onsetdet = new_aubio_onset
         (const_cast<char *>(getAubioNameForOnsetType(m_onsettype)),
-         blockSize,
-         stepSize,
+         m_blockSize,
+         m_stepSize,
          lrintf(m_inputSampleRate));
     
     aubio_onset_set_threshold(m_onsetdet, m_threshold);
     aubio_onset_set_silence(m_onsetdet, m_silence);
     aubio_onset_set_minioi(m_onsetdet, m_minioi);
 
-    m_delay = Vamp::RealTime::frame2RealTime(4 * stepSize,
+    m_delay = Vamp::RealTime::frame2RealTime(4 * m_stepSize,
                                              lrintf(m_inputSampleRate));
 
     m_lastOnset = Vamp::RealTime::zeroTime - m_delay - m_delay;
-
-    return true;
-}
-
-void
-Onset::reset()
-{
 }
 
 size_t
@@ -236,17 +239,6 @@ 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.binCount = 1;
-    d.hasKnownExtents = false;
-    d.isQuantized = false;
-    d.sampleType = OutputDescriptor::OneSamplePerStep;
-    list.push_back(d);
-
     return list;
 }
 
@@ -274,13 +266,7 @@ 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);
-*/
+
     return returnFeatures;
 }