Mercurial > hg > cepstral-pitchtracker
changeset 60:c06fe5350b34
But don't use a mid-stream low-confidence observation to reject a good ongoing hypothesis
author | Chris Cannam |
---|---|
date | Tue, 20 Nov 2012 21:57:49 +0000 |
parents | 82552664d471 |
children | 7c463642a0a7 |
files | NoteHypothesis.cpp test/TestNoteHypothesis.cpp |
diffstat | 2 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/NoteHypothesis.cpp Tue Nov 20 21:31:17 2012 +0000 +++ b/NoteHypothesis.cpp Tue Nov 20 21:57:49 2012 +0000 @@ -98,7 +98,9 @@ // 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; + if (m_pending.empty()) { + m_state = Rejected; + } return false; }
--- a/test/TestNoteHypothesis.cpp Tue Nov 20 21:31:17 2012 +0000 +++ b/test/TestNoteHypothesis.cpp Tue Nov 20 21:57:49 2012 +0000 @@ -73,6 +73,20 @@ BOOST_CHECK(!h.accept(e)); BOOST_CHECK_EQUAL(h.getState(), NoteHypothesis::Rejected); } + +BOOST_AUTO_TEST_CASE(noConfidenceIgnore) +{ + // But if we're already in process we don't go to rejected state, + // we just ignore this hypothesis + NoteHypothesis h; + NoteHypothesis::Estimate e; + BOOST_CHECK_EQUAL(h.getState(), NoteHypothesis::New); + BOOST_CHECK(h.accept(e)); + BOOST_CHECK_EQUAL(h.getState(), NoteHypothesis::Provisional); + e.confidence = 0; + BOOST_CHECK(!h.accept(e)); + BOOST_CHECK_EQUAL(h.getState(), NoteHypothesis::Provisional); +} BOOST_AUTO_TEST_CASE(tooSlow) {