* Update along with latest Vamp API change
[vamp-aubio-plugins.git] / plugins / Pitch.cpp
index 2c43f45..7cab33f 100644 (file)
@@ -14,6 +14,7 @@
 
 */
 
+#include <math.h>
 #include "Pitch.h"
 
 using std::string;
@@ -25,7 +26,7 @@ Pitch::Pitch(float inputSampleRate) :
     Plugin(inputSampleRate),
     m_ibuf(0),
     m_pitchdet(0),
-    m_pitchtype(aubio_pitch_fcomb),
+    m_pitchtype(aubio_pitch_yinfft),
     m_pitchmode(aubio_pitchm_freq)
 {
 }
@@ -37,18 +38,24 @@ Pitch::~Pitch()
 }
 
 string
-Pitch::getName() const
+Pitch::getIdentifier() const
 {
     return "aubiopitch";
 }
 
 string
-Pitch::getDescription() const
+Pitch::getName() const
 {
     return "Aubio Pitch Detector";
 }
 
 string
+Pitch::getDescription() const
+{
+    return "Track estimated note pitches";
+}
+
+string
 Pitch::getMaker() const
 {
     return "Paul Brossier (plugin by Chris Cannam)";
@@ -75,7 +82,7 @@ Pitch::initialise(size_t channels, size_t stepSize, size_t blockSize)
 
     m_ibuf = new_fvec(stepSize, channels);
 
-    m_pitchdet = new_aubio_pitchdetection(blockSize * 4,
+    m_pitchdet = new_aubio_pitchdetection(blockSize,
                                           stepSize,
                                           channels,
                                           lrintf(m_inputSampleRate),
@@ -99,7 +106,7 @@ Pitch::getPreferredStepSize() const
 size_t
 Pitch::getPreferredBlockSize() const
 {
-    return 1024;
+    return 2048;
 }
 
 Pitch::ParameterList
@@ -108,11 +115,11 @@ Pitch::getParameterDescriptors() const
     ParameterList list;
     
     ParameterDescriptor desc;
-    desc.name = "pitchtype";
-    desc.description = "Pitch Detection Function Type";
+    desc.identifier = "pitchtype";
+    desc.name = "Pitch Detection Function Type";
     desc.minValue = 0;
     desc.maxValue = 4;
-    desc.defaultValue = (int)aubio_pitch_fcomb;
+    desc.defaultValue = (int)aubio_pitch_yinfft;
     desc.isQuantized = true;
     desc.quantizeStep = 1;
     desc.valueNames.push_back("YIN Frequency Estimator");
@@ -155,9 +162,9 @@ Pitch::getOutputDescriptors() const
     OutputList list;
 
     OutputDescriptor d;
-    d.name = "frequency";
+    d.identifier = "frequency";
+    d.name = "Frequency";
     d.unit = "Hz";
-    d.description = "Frequency";
     d.hasFixedBinCount = true;
     d.binCount = 1;
     d.hasKnownExtents = false;
@@ -169,7 +176,8 @@ Pitch::getOutputDescriptors() const
 }
 
 Pitch::FeatureSet
-Pitch::process(float **inputBuffers, Vamp::RealTime /* timestamp */)
+Pitch::process(const float *const *inputBuffers,
+               Vamp::RealTime /* timestamp */)
 {
     for (size_t i = 0; i < m_stepSize; ++i) {
         for (size_t j = 0; j < m_channelCount; ++j) {