changeset 13:74ce5b481132

* Fix some step- and block-size related bugs
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 20 Sep 2006 15:31:35 +0000
parents 61c56057ce4a
children 98145d34195e
files plugins/BeatDetect.cpp plugins/ChromagramPlugin.cpp plugins/ConstantQSpectrogram.cpp
diffstat 3 files changed, 22 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/BeatDetect.cpp	Fri May 19 14:22:18 2006 +0000
+++ b/plugins/BeatDetect.cpp	Wed Sep 20 15:31:35 2006 +0000
@@ -148,13 +148,13 @@
 
     if (blockSize != getPreferredStepSize() * 2) {
         std::cerr << "BeatDetector::initialise: Unsupported block size for this sample rate: "
-                  << blockSize << std::endl;
+                  << blockSize << " (wanted " << (getPreferredStepSize() * 2) << ")" << std::endl;
         return false;
     }
 
     if (stepSize != getPreferredStepSize()) {
         std::cerr << "BeatDetector::initialise: Unsupported step size for this sample rate: "
-                  << stepSize << std::endl;
+                  << stepSize << " (wanted " << (getPreferredStepSize()) << ")" << std::endl;
         return false;
     }
 
--- a/plugins/ChromagramPlugin.cpp	Fri May 19 14:22:18 2006 +0000
+++ b/plugins/ChromagramPlugin.cpp	Wed Sep 20 15:31:35 2006 +0000
@@ -197,13 +197,21 @@
     if (channels < getMinChannelCount() ||
 	channels > getMaxChannelCount()) return false;
 
-    if (stepSize != m_step) return false;
-    if (blockSize != m_block) return false;
-
     std::cerr << "ChromagramPlugin::initialise: step " << stepSize << ", block "
 	      << blockSize << std::endl;
 
     m_chromagram = new Chromagram(m_config);
+
+    m_step = m_chromagram->getHopSize();
+    m_block = m_chromagram->getFrameSize();
+
+    if (stepSize != m_step ||
+        blockSize != m_block) {
+        delete m_chromagram;
+        m_chromagram = 0;
+        return false;
+    }
+
     return true;
 }
 
--- a/plugins/ConstantQSpectrogram.cpp	Fri May 19 14:22:18 2006 +0000
+++ b/plugins/ConstantQSpectrogram.cpp	Wed Sep 20 15:31:35 2006 +0000
@@ -197,15 +197,21 @@
     if (channels < getMinChannelCount() ||
 	channels > getMaxChannelCount()) return false;
 
-    if (stepSize != m_step) return false;
-    if (blockSize != m_block) return false;
-
     std::cerr << "ConstantQSpectrogram::initialise: step " << stepSize << ", block "
 	      << blockSize << std::endl;
 
     m_cq = new ConstantQ(m_config);
     m_bins = (int)ceil(m_bpo * log(m_config.max / m_config.min) / log(2.0));
     m_cq->sparsekernel();
+    m_step = m_cq->gethop();
+    m_block = m_cq->getfftlength();
+
+    if (stepSize != m_step ||
+        blockSize != m_block) {
+        delete m_cq;
+        m_cq = 0;
+        return false;
+    }
 
     return true;
 }