diff chroma-compare-plugin/TuningDifference.h @ 13:c74071731d74

The bulk of the chroma-compare implementation. Should be using the newly refactored Chromagram class from libcq though (chroma is currently upside-down!)
author Chris Cannam
date Wed, 04 Feb 2015 15:10:07 +0000
parents 23572f9d25d9
children 994f5294996d
line wrap: on
line diff
--- a/chroma-compare-plugin/TuningDifference.h	Wed Feb 04 10:15:57 2015 +0000
+++ b/chroma-compare-plugin/TuningDifference.h	Wed Feb 04 15:10:07 2015 +0000
@@ -3,6 +3,10 @@
 
 #include <vamp-sdk/Plugin.h>
 
+#include <cq/CQSpectrogram.h>
+
+#include <memory>
+
 using std::string;
 using std::vector;
 
@@ -44,9 +48,25 @@
     FeatureSet getRemainingFeatures();
 
 protected:
+    typedef vector<float> Signal;
+    typedef vector<double> Chroma;
+    typedef vector<double> TFeature;
+
+    int m_bpo;
+    std::unique_ptr<CQSpectrogram> m_refCQ;
+    Chroma m_refTotals;
+    TFeature m_refFeature;
+    Signal m_other;
     int m_blockSize;
-    vector<double> m_sum[2];
     int m_frameCount;
+
+    CQParameters paramsForTuningFrequency(double hz) const;
+    TFeature computeFeatureFromTotals(const Chroma &totals) const;
+    TFeature computeFeatureFromSignal(const Signal &signal, double hz) const;
+    double featureDistance(const TFeature &other, int rotation = 0) const;
+    int findBestRotation(const TFeature &other) const;
+
+    mutable std::map<string, int> m_outputs;
 };