Mercurial > hg > vamp-aubio-plugins
changeset 5:75189a3dc043
set negative timestamps to zero
author | Paul Brossier <piem@piem.org> |
---|---|
date | Wed, 17 May 2006 15:15:12 +0000 |
parents | be376e1b36c3 |
children | 1ad0444bd0ff |
files | plugins/Notes.cpp plugins/Notes.h plugins/Onset.cpp |
diffstat | 3 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/Notes.cpp Wed May 17 13:38:26 2006 +0000 +++ b/plugins/Notes.cpp Wed May 17 15:15:12 2006 +0000 @@ -112,6 +112,8 @@ m_pitchmode); m_count = 0; + m_delay = Vamp::RealTime::frame2RealTime((4 + m_median) * m_stepSize, + lrintf(m_inputSampleRate)); m_currentOnset = Vamp::RealTime::zeroTime; m_haveCurrent = false; @@ -324,9 +326,8 @@ Feature feature; feature.hasTimestamp = true; - feature.timestamp = m_currentOnset - - Vamp::RealTime::frame2RealTime((4 + m_median) * m_stepSize, - m_inputSampleRate); + if (m_currentOnset < m_delay) m_currentOnset = m_delay; + feature.timestamp = m_currentOnset - m_delay; feature.values.push_back(median); // feature.values.push_back(FLOOR(aubio_freqtomidi(median) + 0.5)); feature.values.push_back
--- a/plugins/Notes.h Wed May 17 13:38:26 2006 +0000 +++ b/plugins/Notes.h Wed May 17 15:15:12 2006 +0000 @@ -71,6 +71,7 @@ size_t m_channelCount; std::deque<float> m_notebuf; size_t m_count; + Vamp::RealTime m_delay; Vamp::RealTime m_currentOnset; Vamp::RealTime m_lastTimeStamp; float m_currentLevel;
--- a/plugins/Onset.cpp Wed May 17 13:38:26 2006 +0000 +++ b/plugins/Onset.cpp Wed May 17 15:15:12 2006 +0000 @@ -250,6 +250,7 @@ if (timestamp - m_lastOnset >= m_delay) { Feature onsettime; onsettime.hasTimestamp = true; + if (timestamp < m_delay) timestamp = m_delay; onsettime.timestamp = timestamp - m_delay; returnFeatures[0].push_back(onsettime); m_lastOnset = timestamp;