diff dsp/onsets/DetectionFunction.cpp @ 289:befe5aa6b450

* Refactor FFT a little bit so as to separate construction and processing rather than have a single static method -- will make it easier to use a different implementation * pull in KissFFT implementation (not hooked up yet)
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 13 May 2009 09:19:12 +0000
parents 9c403afdd9e9
children e5907ae6de17
line wrap: on
line diff
--- a/dsp/onsets/DetectionFunction.cpp	Tue May 12 21:04:25 2009 +0000
+++ b/dsp/onsets/DetectionFunction.cpp	Wed May 13 09:19:12 2009 +0000
@@ -58,7 +58,9 @@
     m_magPeaks = new double[ m_halfLength ];
     memset(m_magPeaks,0, m_halfLength*sizeof(double));
 
-    m_phaseVoc = new PhaseVocoder;
+    // See note in process(const double *) below
+    int actualLength = MathUtilities::previousPowerOfTwo(m_dataLength);
+    m_phaseVoc = new PhaseVocoder(actualLength);
 
     m_DFWindowedFrame = new double[ m_dataLength ];
     m_magnitude = new double[ m_halfLength ];
@@ -104,7 +106,7 @@
         }
     }
 
-    m_phaseVoc->process(actualLength, m_DFWindowedFrame, m_magnitude, m_thetaAngle);
+    m_phaseVoc->process(m_DFWindowedFrame, m_magnitude, m_thetaAngle);
 
     if (m_whiten) whiten();