diff Tempogram.cpp @ 8:4e429b9f2b4d

* Fixed memory leak bug. Issue with calculating size of spectrogram array. * Fixed bug in Tempogram::reset() where specData wasn't reinitialised.
author Carl Bussey <c.bussey@se10.qmul.ac.uk>
date Thu, 07 Aug 2014 17:25:24 +0100
parents 21147df9cb2d
children be59b4a73f49
line wrap: on
line diff
--- a/Tempogram.cpp	Thu Aug 07 16:21:21 2014 +0100
+++ b/Tempogram.cpp	Thu Aug 07 17:25:24 2014 +0100
@@ -269,12 +269,12 @@
     cleanupForGRF();
     ncTimestamps.clear();
     specData.clear();
+    specData = vector< vector<float> >(m_blockSize/2 + 1);
 }
 
 Tempogram::FeatureSet
 Tempogram::process(const float *const *inputBuffers, Vamp::RealTime timestamp)
 {
-    
     size_t n = m_blockSize/2 + 1;
     
     FeatureSet featureSet;
@@ -337,10 +337,7 @@
     WindowFunction::hanning(hannWindowtN, tN);
     Spectrogram * spectrogramProcessor = new Spectrogram(numberOfBlocks, tN, thopSize);
     vector< vector<float> > tempogram = spectrogramProcessor->audioToMagnitudeSpectrogram(&noveltyCurve[0], hannWindowtN);
-    
-    cout << "About to delete..." << endl;
     delete spectrogramProcessor;
-    cout << "Deleted!" << endl;
     spectrogramProcessor = NULL;
     
     int timePointer = thopSize-tN/2;
@@ -351,8 +348,6 @@
         
         int timeMS = floor(1000*(m_stepSize*timePointer)/m_inputSampleRate + 0.5);
         
-        cout << timeMS << endl;
-        
         for(int k = 0; k < tN/2 + 1; k++){
             feature.values.push_back(tempogram[k][block]);
         }