changeset 6:80fae79c9472

* implement reset()!
author cannam
date Mon, 23 Mar 2009 19:47:01 +0000
parents a02321c31884
children b3ec48d9cd2e
files MatchVampPlugin.cpp MatchVampPlugin.h
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MatchVampPlugin.cpp	Tue Dec 02 13:13:25 2008 +0000
+++ b/MatchVampPlugin.cpp	Mon Mar 23 19:47:01 2009 +0000
@@ -42,6 +42,7 @@
 
 MatchVampPlugin::MatchVampPlugin(float inputSampleRate) :
     Plugin(inputSampleRate),
+    m_stepSize(0),
     m_serialise(false),
     m_begin(true),
     m_locked(false)
@@ -183,6 +184,7 @@
 	channels > getMaxChannelCount()) return false;
     if (stepSize > blockSize/2 ||
         blockSize != getPreferredBlockSize()) return false;
+    m_stepSize = stepSize;
     pm1->setHopSize(stepSize);
     pm2->setHopSize(stepSize);
     m_begin = true;
@@ -193,7 +195,18 @@
 void
 MatchVampPlugin::reset()
 {
-    //!!!???
+    delete feeder;
+    delete pm1;
+    delete pm2;
+    feeder = 0;
+    pm1 = 0;
+    pm2 = 0;
+
+    createMatchers();
+    pm1->setHopSize(m_stepSize);
+    pm2->setHopSize(m_stepSize);
+    m_begin = true;
+    m_locked = false;
 }
 
 MatchVampPlugin::OutputList
--- a/MatchVampPlugin.h	Tue Dec 02 13:13:25 2008 +0000
+++ b/MatchVampPlugin.h	Mon Mar 23 19:47:01 2009 +0000
@@ -68,6 +68,7 @@
     mutable Matcher *pm1;
     mutable Matcher *pm2;
     mutable MatchFeeder *feeder;
+    size_t m_stepSize;
     bool m_serialise;
     bool m_begin;
     bool m_locked;