changeset 135:75a46075bf4e darwintunes

Initialise logFreqMatrix elements to zero before loop to ensure none gets missed
author Chris Cannam
date Thu, 10 May 2012 11:32:05 +0100
parents 57bf719bce30
children 2748660cb421 8ff2aa01df4d
files chromamethods.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/chromamethods.cpp	Wed Sep 28 11:09:40 2011 +0100
+++ b/chromamethods.cpp	Thu May 10 11:32:05 2012 +0100
@@ -143,6 +143,10 @@
         fft_activation.push_back(cosp);
         // cerr << cosp << endl;
     }
+
+    for (int i = 0; i < nFFT * cq_f.size(); ++i) {
+        outmatrix[i] = 0.f;
+    }
 	
     float cq_activation;
     for (int iFFT = 1; iFFT < nFFT; ++iFFT) {
@@ -151,7 +155,6 @@
         int curr_end = oversampling * iFFT + oversampling; // don't know if I should add "+1" here
         // cerr << oversampled_f[curr_start] << " " << fft_f[iFFT] << " " << oversampled_f[curr_end] << endl;
         for (int iCQ = 0; iCQ < (int)cq_f.size(); ++iCQ) {
-            outmatrix[iFFT + nFFT * iCQ] = 0;
             if (cq_f[iCQ] * pow(2.0, 0.084) + fft_width > fft_f[iFFT] && cq_f[iCQ] * pow(2.0, -0.084 * 2) - fft_width < fft_f[iFFT]) { // within a generous neighbourhood
                 for (int iOS = curr_start; iOS < curr_end; ++iOS) {
                     cq_activation = pitchCospuls(oversampled_f[iOS],cq_f[iCQ],binspersemitone*12);