changeset 156:b34df30fd7e4

Defensive initialisation
author Chris Cannam <c.cannam@qmul.ac.uk>
date Mon, 04 Aug 2014 09:21:48 +0100
parents 72dd182be968
children 8d6c503baf0d b83fa746d292
files src/CQSpectrogram.cpp src/ConstantQ.cpp
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/CQSpectrogram.cpp	Mon Jul 14 12:44:37 2014 +0100
+++ b/src/CQSpectrogram.cpp	Mon Aug 04 09:21:48 2014 +0100
@@ -37,6 +37,8 @@
 using std::cerr;
 using std::endl;
 
+//#define DEBUG_CQSPECTROGRAM 1
+
 CQSpectrogram::CQSpectrogram(CQParameters params,
                              Interpolation interpolation) :
     m_cq(params),
@@ -71,14 +73,14 @@
         int height = cq[i].size();
         RealColumn col(height, 0);
         for (int j = 0; j < height; ++j) {
-
+#ifdef DEBUG_CQSPECTROGRAM
             if (isnan(cq[i][j].real())) {
                 cerr << "WARNING: NaN in real at (" << i << "," << j << ")" << endl;
             }
             if (isnan(cq[i][j].imag())) {
                 cerr << "WARNING: NaN in imag at (" << i << "," << j << ")" << endl;
             }
-
+#endif
             col[j] = abs(cq[i][j]);
         }
         spec.push_back(col);
--- a/src/ConstantQ.cpp	Mon Jul 14 12:44:37 2014 +0100
+++ b/src/ConstantQ.cpp	Mon Aug 04 09:21:48 2014 +0100
@@ -53,6 +53,7 @@
     m_maxFrequency(params.maxFrequency),
     m_minFrequency(params.minFrequency),
     m_binsPerOctave(params.binsPerOctave),
+    m_kernel(0),
     m_fft(0)
 {
     if (m_minFrequency <= 0.0 || m_maxFrequency <= 0.0) {