diff CepstrumPitchTracker.cpp @ 13:6f73de098d35 track

Another small fix
author Chris Cannam
date Sat, 30 Jun 2012 10:12:08 +0100
parents 1daaf43a5459
children 98256077e2a2
line wrap: on
line diff
--- a/CepstrumPitchTracker.cpp	Sat Jun 30 10:10:05 2012 +0100
+++ b/CepstrumPitchTracker.cpp	Sat Jun 30 10:12:08 2012 +0100
@@ -489,9 +489,13 @@
     }
 
     if (!m_accepted.test(e)) {
+
         int candidate = -1;
+        bool accepted = false;
+
         for (int i = 0; i < m_possible.size(); ++i) {
             if (m_possible[i].test(e)) {
+                accepted = true;
                 if (m_possible[i].getState() == Hypothesis::Satisfied) {
                     candidate = i;
                 }
@@ -499,6 +503,12 @@
             }
         }
 
+        if (!accepted) {
+            Hypothesis h;
+            h.test(e); //!!! must succeed as h is new, so perhaps there should be a ctor for this
+            m_possible.push_back(h);
+        }
+
         if (m_accepted.getState() == Hypothesis::Expired) {
             m_accepted.addFeatures(fs[0]);
         }