comparison src/Silvet.cpp @ 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
comparison
equal deleted inserted replaced
186:9d70d687e4eb 187:1697457458b7
694 cerr << "INTERNAL ERROR: Feeder is not a poly-note-hypothesis-feeder!" 694 cerr << "INTERNAL ERROR: Feeder is not a poly-note-hypothesis-feeder!"
695 << endl; 695 << endl;
696 return noteFeatures; 696 return noteFeatures;
697 } 697 }
698 698
699 std::set<NoteHypothesis> hh = feeder->getAcceptedHypotheses(); 699 std::set<NoteHypothesis> hh = feeder->retrieveAcceptedHypotheses();
700 700
701 //!!! inefficient 701 //!!! inefficient
702 for (std::set<NoteHypothesis>::const_iterator hi = hh.begin(); 702 for (std::set<NoteHypothesis>::const_iterator hi = hh.begin();
703 hi != hh.end(); ++hi) { 703 hi != hh.end(); ++hi) {
704 704
705 NoteHypothesis h(*hi); 705 NoteHypothesis h(*hi);
706
707 if (m_emitted.find(h) != m_emitted.end()) {
708 continue; // already returned this one
709 }
710
711 m_emitted.insert(h);
712 706
713 NoteHypothesis::Note n = h.getAveragedNote(); 707 NoteHypothesis::Note n = h.getAveragedNote();
714 708
715 int velocity = n.confidence * 127; 709 int velocity = n.confidence * 127;
716 if (velocity > 127) velocity = 127; 710 if (velocity > 127) velocity = 127;