diff src/vamp-hostsdk/PluginBufferingAdapter.cpp @ 267:93c81a6c917a

* Ensure PluginBufferingAdapter returns fresh output descriptors after a call to initialise, setParameter or selectProgram * Fix RDF document base prefix
author cannam
date Tue, 25 Nov 2008 12:34:45 +0000
parents 4454843ff384
children 6579e441f2fe
line wrap: on
line diff
--- a/src/vamp-hostsdk/PluginBufferingAdapter.cpp	Thu Nov 20 21:51:37 2008 +0000
+++ b/src/vamp-hostsdk/PluginBufferingAdapter.cpp	Tue Nov 25 12:34:45 2008 +0000
@@ -64,6 +64,9 @@
 
     OutputList getOutputDescriptors() const;
 
+    void setParameter(std::string, float);
+    void selectProgram(std::string);
+
     void reset();
 
     FeatureSet process(const float *const *inputBuffers, RealTime timestamp);
@@ -311,6 +314,18 @@
 }
 
 void
+PluginBufferingAdapter::setParameter(std::string name, float value)
+{
+    m_impl->setParameter(name, value);
+}
+
+void
+PluginBufferingAdapter::selectProgram(std::string name)
+{
+    m_impl->selectProgram(name);
+}
+
+void
 PluginBufferingAdapter::reset()
 {
     m_impl->reset();
@@ -458,7 +473,16 @@
         m_buffers[i] = new float[m_blockSize];
     }
     
-    return m_plugin->initialise(m_channels, m_stepSize, m_blockSize);
+    bool success = m_plugin->initialise(m_channels, m_stepSize, m_blockSize);
+
+    if (success) {
+        // Re-query outputs; properties such as bin count may have
+        // changed on initialise
+        m_outputs.clear();
+        (void)getOutputDescriptors();
+    }
+
+    return success;
 }
 		
 PluginBufferingAdapter::OutputList
@@ -501,6 +525,26 @@
 }
 
 void
+PluginBufferingAdapter::Impl::setParameter(std::string name, float value)
+{
+    m_plugin->setParameter(name, value);
+
+    // Re-query outputs; properties such as bin count may have changed
+    m_outputs.clear();
+    (void)getOutputDescriptors();
+}
+
+void
+PluginBufferingAdapter::Impl::selectProgram(std::string name)
+{
+    m_plugin->selectProgram(name);
+
+    // Re-query outputs; properties such as bin count may have changed
+    m_outputs.clear();
+    (void)getOutputDescriptors();
+}
+
+void
 PluginBufferingAdapter::Impl::reset()
 {
     m_frame = 0;