# HG changeset patch # User cannam # Date 1201771487 0 # Node ID 08d8c8ee6097ce3e967ede53313ec588ca74c04e # Parent 2cb46126ef591d0194381ec5310c19e677c3a67d * implement reset() in PluginBufferingAdapter diff -r 2cb46126ef59 -r 08d8c8ee6097 vamp-sdk/hostext/PluginBufferingAdapter.cpp --- a/vamp-sdk/hostext/PluginBufferingAdapter.cpp Tue Jan 29 16:13:22 2008 +0000 +++ b/vamp-sdk/hostext/PluginBufferingAdapter.cpp Thu Jan 31 09:24:47 2008 +0000 @@ -57,6 +57,8 @@ OutputList getOutputDescriptors() const; + void reset(); + FeatureSet process(const float *const *inputBuffers, RealTime timestamp); FeatureSet getRemainingFeatures(); @@ -225,7 +227,8 @@ vector m_queue; float **m_buffers; float m_inputSampleRate; - RealTime m_timestamp; + RealTime m_timestamp; + bool m_unrun; OutputList m_outputs; void processBlock(FeatureSet& allFeatureSets, RealTime timestamp); @@ -253,6 +256,12 @@ { return m_impl->getOutputDescriptors(); } + +void +PluginBufferingAdapter::reset() +{ + m_impl->reset(); +} PluginBufferingAdapter::FeatureSet PluginBufferingAdapter::process(const float *const *inputBuffers, @@ -277,7 +286,8 @@ m_queue(0), m_buffers(0), m_inputSampleRate(inputSampleRate), - m_timestamp() + m_timestamp(RealTime::zeroTime), + m_unrun(true) { m_outputs = plugin->getOutputDescriptors(); } @@ -365,11 +375,27 @@ return outs; } +void +PluginBufferingAdapter::Impl::reset() +{ + m_timestamp = RealTime::zeroTime; + m_unrun = true; + + for (size_t i = 0; i < m_queue.size(); ++i) { + m_queue[i]->reset(); + } +} + PluginBufferingAdapter::FeatureSet PluginBufferingAdapter::Impl::process(const float *const *inputBuffers, RealTime timestamp) { FeatureSet allFeatureSets; + + if (m_unrun) { + m_timestamp = timestamp; + m_unrun = false; + } // queue the new input diff -r 2cb46126ef59 -r 08d8c8ee6097 vamp-sdk/hostext/PluginBufferingAdapter.h --- a/vamp-sdk/hostext/PluginBufferingAdapter.h Tue Jan 29 16:13:22 2008 +0000 +++ b/vamp-sdk/hostext/PluginBufferingAdapter.h Thu Jan 31 09:24:47 2008 +0000 @@ -81,6 +81,8 @@ OutputList getOutputDescriptors() const; + void reset(); + FeatureSet process(const float *const *inputBuffers, RealTime timestamp); FeatureSet getRemainingFeatures();