changeset 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 53b0e7557c52
children 6579e441f2fe
files examples/vamp-example-plugins.n3 rdf/generator/vamp-rdf-template-generator.cpp src/vamp-hostsdk/PluginBufferingAdapter.cpp vamp-hostsdk/PluginBufferingAdapter.h
diffstat 4 files changed, 50 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/examples/vamp-example-plugins.n3	Thu Nov 20 21:51:37 2008 +0000
+++ b/examples/vamp-example-plugins.n3	Tue Nov 25 12:34:45 2008 +0000
@@ -7,7 +7,7 @@
 @prefix af:       <http://purl.org/ontology/af/> .
 @prefix foaf:     <http://xmlns.com/foaf/0.1/> .
 @prefix cc:       <http://web.resource.org/cc/> .
-@prefix :         <> .
+@prefix :         <#> .
 
 <>  a   vamp:PluginDescription ;
     foaf:maker          <http://www.vamp-plugins.org/doap.rdf#template-generator> ;
--- a/rdf/generator/vamp-rdf-template-generator.cpp	Thu Nov 20 21:51:37 2008 +0000
+++ b/rdf/generator/vamp-rdf-template-generator.cpp	Tue Nov 25 12:34:45 2008 +0000
@@ -69,7 +69,7 @@
 @prefix af:       <http://purl.org/ontology/af/> .\n\
 @prefix foaf:     <http://xmlns.com/foaf/0.1/> .\n\
 @prefix cc:       <http://web.resource.org/cc/> .\n\
-@prefix :         <> .\n\n";
+@prefix :         <#> .\n\n";
 	
     return res;
 }
--- 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;
--- a/vamp-hostsdk/PluginBufferingAdapter.h	Thu Nov 20 21:51:37 2008 +0000
+++ b/vamp-hostsdk/PluginBufferingAdapter.h	Tue Nov 25 12:34:45 2008 +0000
@@ -169,6 +169,9 @@
      */
     void getActualStepAndBlockSizes(size_t &stepSize, size_t &blockSize);
 
+    void setParameter(std::string, float);
+    void selectProgram(std::string);
+
     OutputList getOutputDescriptors() const;
 
     void reset();