Mercurial > hg > sonic-annotator
changeset 123:b514bae9555e
Do not feed audio data to a plugin before its transform's start time (we might be feeding other transforms that started earlier). This breaks a test, but the test's expected output was broken (rather alarmingly)! Note that this does mean a plugin may have to-next-block "leakage" at start as well as end of its start-duration zone.
author | Chris Cannam |
---|---|
date | Wed, 08 Oct 2014 18:44:40 +0100 |
parents | eb0f3a2029b8 |
children | c72889726a98 |
files | runner/FeatureExtractionManager.cpp |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/runner/FeatureExtractionManager.cpp Wed Oct 08 15:38:48 2014 +0100 +++ b/runner/FeatureExtractionManager.cpp Wed Oct 08 18:44:40 2014 +0100 @@ -766,6 +766,27 @@ foreach (Plugin *plugin, m_orderedPlugins) { PluginMap::iterator pi = m_plugins.find(plugin); + + // Skip any plugin none of whose transforms have come + // around yet. (Though actually, all transforms for a + // given plugin must have the same start time -- they can + // only differ in output and summary type.) + bool inRange = false; + for (TransformWriterMap::const_iterator ti = pi->second.begin(); + ti != pi->second.end(); ++ti) { + int startFrame = RealTime::realTime2Frame + (ti->first.getStartTime(), m_sampleRate); + cerr << "plugin " << plugin << " transform " << &(ti->first) << " start frame " << startFrame << " my frame " << i << endl; + if (i >= startFrame || i + m_blockSize > startFrame) { + inRange = true; + break; + } + } + if (!inRange) { + cerr << "not in range! plugging on" << endl; + continue; + } + Plugin::FeatureSet featureSet = plugin->process(data, timestamp); if (!m_summariesOnly) {