changeset 187:1697457458b7 noteagent

Don't retain returned hypotheses -- to avoid having to test whether we've seen them before
author Chris Cannam
date Wed, 28 May 2014 15:16:00 +0100
parents 9d70d687e4eb
children 462b165c8c0f
files src/AgentFeederMono.h src/AgentFeederPoly.h src/Silvet.cpp src/Silvet.h
diffstat 4 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/AgentFeederMono.h	Wed May 28 15:05:43 2014 +0100
+++ b/src/AgentFeederMono.h	Wed May 28 15:16:00 2014 +0100
@@ -148,8 +148,10 @@
         }
     }
 
-    Hypotheses getAcceptedHypotheses() const {
-        return m_accepted;
+    Hypotheses retrieveAcceptedHypotheses() {
+        Hypotheses aa = m_accepted;
+        m_accepted.clear();
+        return aa;
     }
 
 private:
--- a/src/AgentFeederPoly.h	Wed May 28 15:05:43 2014 +0100
+++ b/src/AgentFeederPoly.h	Wed May 28 15:16:00 2014 +0100
@@ -71,12 +71,13 @@
         }
     }
 
-    std::set<Hypothesis> getAcceptedHypotheses() const {
+    std::set<Hypothesis> retrieveAcceptedHypotheses() {
         std::set<Hypothesis> hs;
         for (typename Hypotheses::const_iterator i = m_state.completed.begin();
              i != m_state.completed.end(); ++i) {
             hs.insert(*i);
         }
+        m_state.completed.clear();
         return hs;
     }
 
--- a/src/Silvet.cpp	Wed May 28 15:05:43 2014 +0100
+++ b/src/Silvet.cpp	Wed May 28 15:16:00 2014 +0100
@@ -696,7 +696,7 @@
         return noteFeatures;
     }
 
-    std::set<NoteHypothesis> hh = feeder->getAcceptedHypotheses();
+    std::set<NoteHypothesis> hh = feeder->retrieveAcceptedHypotheses();
 
     //!!! inefficient
     for (std::set<NoteHypothesis>::const_iterator hi = hh.begin();
@@ -704,12 +704,6 @@
 
         NoteHypothesis h(*hi);
 
-        if (m_emitted.find(h) != m_emitted.end()) {
-            continue; // already returned this one
-        }
-
-        m_emitted.insert(h);
-
         NoteHypothesis::Note n = h.getAveragedNote();
 
         int velocity = n.confidence * 127;
--- a/src/Silvet.h	Wed May 28 15:05:43 2014 +0100
+++ b/src/Silvet.h	Wed May 28 15:16:00 2014 +0100
@@ -88,7 +88,6 @@
     vector<MedianFilter<double> *> m_postFilter;
 
     AgentFeeder *m_agentFeeder;
-    std::set<NoteHypothesis> m_emitted;
 
     Grid preProcess(const Grid &);