comparison runner/FeatureExtractionManager.cpp @ 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 5be4995f4029
children 7a7a46d4bd3c
comparison
equal deleted inserted replaced
122:eb0f3a2029b8 123:b514bae9555e
764 (i, m_sampleRate); 764 (i, m_sampleRate);
765 765
766 foreach (Plugin *plugin, m_orderedPlugins) { 766 foreach (Plugin *plugin, m_orderedPlugins) {
767 767
768 PluginMap::iterator pi = m_plugins.find(plugin); 768 PluginMap::iterator pi = m_plugins.find(plugin);
769
770 // Skip any plugin none of whose transforms have come
771 // around yet. (Though actually, all transforms for a
772 // given plugin must have the same start time -- they can
773 // only differ in output and summary type.)
774 bool inRange = false;
775 for (TransformWriterMap::const_iterator ti = pi->second.begin();
776 ti != pi->second.end(); ++ti) {
777 int startFrame = RealTime::realTime2Frame
778 (ti->first.getStartTime(), m_sampleRate);
779 cerr << "plugin " << plugin << " transform " << &(ti->first) << " start frame " << startFrame << " my frame " << i << endl;
780 if (i >= startFrame || i + m_blockSize > startFrame) {
781 inRange = true;
782 break;
783 }
784 }
785 if (!inRange) {
786 cerr << "not in range! plugging on" << endl;
787 continue;
788 }
789
769 Plugin::FeatureSet featureSet = plugin->process(data, timestamp); 790 Plugin::FeatureSet featureSet = plugin->process(data, timestamp);
770 791
771 if (!m_summariesOnly) { 792 if (!m_summariesOnly) {
772 writeFeatures(audioSource, plugin, featureSet); 793 writeFeatures(audioSource, plugin, featureSet);
773 } 794 }