Mercurial > hg > cepstral-pitchtracker
diff NoteHypothesis.cpp @ 58:9f50a5876dd3
Avoid accepting estimates with negligible confidence
author | Chris Cannam |
---|---|
date | Tue, 20 Nov 2012 21:30:35 +0000 |
parents | 34f42a384a7f |
children | 82552664d471 |
line wrap: on
line diff
--- a/NoteHypothesis.cpp Thu Sep 27 17:22:51 2012 +0100 +++ b/NoteHypothesis.cpp Tue Nov 20 21:30:35 2012 +0000 @@ -64,7 +64,6 @@ NoteHypothesis::isOutOfDateFor(Estimate s) const { if (m_pending.empty()) return false; - return ((s.time - m_pending[m_pending.size()-1].time) > RealTime::fromMilliseconds(40)); } @@ -93,6 +92,16 @@ { bool accept = false; + static double negligibleConfidence = 0.0001; + + if (s.confidence < negligibleConfidence) { + // avoid piling up a lengthy sequence of estimates that are + // all acceptable but are in total not enough to cause us to + // be satisfied + m_state = Rejected; + return false; + } + switch (m_state) { case New: