changeset 79:021f69b2987a

Backed out changeset 3393a2898a1d
author Chris Cannam <c.cannam@qmul.ac.uk>
date Mon, 07 Apr 2014 16:14:24 +0100
parents 4a3005934850
children 872fc9dc0321
files cpp-qm-dsp/ConstantQ.cpp
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/cpp-qm-dsp/ConstantQ.cpp	Fri Apr 04 13:50:27 2014 +0100
+++ b/cpp-qm-dsp/ConstantQ.cpp	Mon Apr 07 16:14:24 2014 +0100
@@ -111,10 +111,8 @@
 
         int factor = pow(2, i);
 
-        // Each octave uses an identical fs/2 resampler fed with the
-        // output from that of the octave above
         Resampler *r = new Resampler
-            (sourceRate, sourceRate / 2, 60, 0.02);
+            (sourceRate, sourceRate / factor, 60, 0.02);
 
         // We need to adapt the latencies so as to get the first input
         // sample to be aligned, in time, at the decimator output
@@ -146,7 +144,7 @@
 	// use that to compensate in a moment, when we've discovered
 	// what the longest latency across all octaves is.
 
-        latencies.push_back(r->getLatency() + latencies[i-1]);
+        latencies.push_back(r->getLatency() * factor);
         m_decimators.push_back(r);
     }
 
@@ -222,10 +220,8 @@
 {
     m_buffers[0].insert(m_buffers[0].end(), td.begin(), td.end());
 
-    vector<double> dec(td);
-
     for (int i = 1; i < m_octaves; ++i) {
-        dec = m_decimators[i]->process(dec.data(), dec.size());
+        vector<double> dec = m_decimators[i]->process(td.data(), td.size());
         m_buffers[i].insert(m_buffers[i].end(), dec.begin(), dec.end());
     }