changeset 1:de792b8c2801

* update from other repo
author cannam
date Wed, 04 Jun 2008 19:32:59 +0000
parents 640f92242cc1
children d7c1799d3ad4
files MatchVampPlugin.cpp Matcher.cpp Matcher.h
diffstat 3 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MatchVampPlugin.cpp	Wed Oct 24 12:13:43 2007 +0000
+++ b/MatchVampPlugin.cpp	Wed Jun 04 19:32:59 2008 +0000
@@ -181,8 +181,10 @@
     if (!pm1) createMatchers();
     if (channels < getMinChannelCount() ||
 	channels > getMaxChannelCount()) return false;
-    if (stepSize != getPreferredStepSize() ||
+    if (stepSize > blockSize/2 ||
         blockSize != getPreferredBlockSize()) return false;
+    pm1->setHopSize(stepSize);
+    pm2->setHopSize(stepSize);
     m_begin = true;
     m_locked = false;
     return true;
--- a/Matcher.cpp	Wed Oct 24 12:13:43 2007 +0000
+++ b/Matcher.cpp	Wed Jun 04 19:32:59 2008 +0000
@@ -61,6 +61,19 @@
 
 } // default constructor
 
+void
+Matcher::setHopSize(int sz)
+{
+    if (initialised) {
+        std::cerr << "Matcher::setHopSize: Can't set after use" << std::endl;
+        return;
+    }
+
+    hopSize = sz;
+    hopTime = float(hopSize) / sampleRate;
+    blockTime = blockSize * hopTime;
+}
+
 Matcher::~Matcher()
 {
     std::cerr << "Matcher(" << this << ")::~Matcher()" << std::endl;
--- a/Matcher.h	Wed Oct 24 12:13:43 2007 +0000
+++ b/Matcher.h	Wed Jun 04 19:32:59 2008 +0000
@@ -249,6 +249,8 @@
         return frameCount;
     }
 
+    void setHopSize(int);
+
 protected:
     template <typename T>
     void initVector(vector<T> &vec, int sz, T dflt = 0) {