diff examples/FixedTempoEstimator.cpp @ 271:23352e424631

* minor adjustments, avoid a stupid memory leak
author cannam
date Wed, 26 Nov 2008 22:36:47 +0000
parents 88ef5ffdbe8d
children c97e70ed5abc
line wrap: on
line diff
--- a/examples/FixedTempoEstimator.cpp	Wed Nov 26 13:54:17 2008 +0000
+++ b/examples/FixedTempoEstimator.cpp	Wed Nov 26 22:36:47 2008 +0000
@@ -248,8 +248,7 @@
 }
 
 bool
-FixedTempoEstimator::D::initialise(size_t channels,
-                                   size_t stepSize, size_t blockSize)
+FixedTempoEstimator::D::initialise(size_t, size_t stepSize, size_t blockSize)
 {
     m_stepSize = stepSize;
     m_blockSize = blockSize;
@@ -406,7 +405,7 @@
 
     for (int i = 0; i < n/2; ++i) {
 
-        for (int j = i; j < n-1; ++j) {
+        for (int j = i; j < n; ++j) {
             m_r[i] += m_df[j] * m_df[j - i];
         }
 
@@ -527,7 +526,7 @@
 
     std::map<float, int> candidates;
 
-    for (int i = p0; i <= p1 && i < n/2-1; ++i) {
+    for (int i = p0; i <= p1 && i+1 < n/2; ++i) {
 
         if (m_fr[i] > m_fr[i-1] &&
             m_fr[i] > m_fr[i+1]) {
@@ -622,6 +621,7 @@
 
 FixedTempoEstimator::~FixedTempoEstimator()
 {
+    delete m_d;
 }
 
 string