changeset 5:d2f7a8295671

Merge
author Chris Cannam
date Fri, 07 Mar 2014 16:21:22 +0000
parents 3bf29717cc01 (diff) 32d91b97af7c (current diff)
children e9b629578488
files
diffstat 2 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ConstrainedHarmonicPeak.cpp	Fri Mar 07 15:58:49 2014 +0000
+++ b/ConstrainedHarmonicPeak.cpp	Fri Mar 07 16:21:22 2014 +0000
@@ -10,7 +10,7 @@
 
 ConstrainedHarmonicPeak::ConstrainedHarmonicPeak(float inputSampleRate) :
     Plugin(inputSampleRate),
-    m_blockSize(0),
+    m_fftSize(0),
     m_minFreq(0),
     m_maxFreq(inputSampleRate/2),
     m_harmonics(5)
@@ -199,7 +199,7 @@
 	return false;
     }
 
-    m_blockSize = blockSize;
+    m_fftSize = blockSize;
 
     return true;
 }
@@ -243,18 +243,18 @@
 {
     FeatureSet fs;
 
-    int hs = m_blockSize/2;
+    int hs = m_fftSize/2;
 
     double *mags = new double[hs+1];
     for (int i = 0; i <= hs; ++i) {
-	mags[i] = sqrtf(inputBuffers[0][i*2] * inputBuffers[0][i*2] +
-			inputBuffers[0][i*2+1] * inputBuffers[0][i*2+1]);
+	mags[i] = sqrt(inputBuffers[0][i*2] * inputBuffers[0][i*2] +
+		       inputBuffers[0][i*2+1] * inputBuffers[0][i*2+1]);
     }
 
     // bin freq is bin * samplerate / fftsize
 
-    int minbin = int(floor((m_minFreq * m_blockSize) / m_inputSampleRate));
-    int maxbin = int(ceil((m_maxFreq * m_blockSize) / m_inputSampleRate));
+    int minbin = int(floor((m_minFreq * m_fftSize) / m_inputSampleRate));
+    int maxbin = int(ceil((m_maxFreq * m_fftSize) / m_inputSampleRate));
     if (minbin > hs) minbin = hs;
     if (maxbin > hs) maxbin = hs;
     if (maxbin <= minbin) return fs;
@@ -295,7 +295,7 @@
     double interpolated = findInterpolatedPeak(hps, maxidx, maxbin - minbin + 1);
     interpolated = interpolated + minbin;
 
-    double freq = interpolated * m_inputSampleRate / m_blockSize;
+    double freq = interpolated * m_inputSampleRate / m_fftSize;
 
     Feature f;
     f.values.push_back(freq);
--- a/ConstrainedHarmonicPeak.h	Fri Mar 07 15:58:49 2014 +0000
+++ b/ConstrainedHarmonicPeak.h	Fri Mar 07 16:21:22 2014 +0000
@@ -43,7 +43,7 @@
     FeatureSet getRemainingFeatures();
 
 protected:
-    int m_blockSize;
+    int m_fftSize;
     float m_minFreq;
     float m_maxFreq;
     int m_harmonics;