changeset 79:9e027aa5b5c3

* Avoid instantiating a plugin twice when configuring it (the min/max channel count call was instantiating the plugin again) * Add static library credits to the About box for static builds
author Chris Cannam
date Mon, 24 Apr 2006 15:52:20 +0000
parents c983dda79f72
children 8739096929dd
files plugin/FeatureExtractionPluginFactory.cpp transform/TransformFactory.cpp transform/TransformFactory.h
diffstat 3 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugin/FeatureExtractionPluginFactory.cpp	Thu Apr 13 18:29:10 2006 +0000
+++ b/plugin/FeatureExtractionPluginFactory.cpp	Mon Apr 24 15:52:20 2006 +0000
@@ -263,6 +263,8 @@
 
     rv = new Vamp::PluginHostAdapter(descriptor, inputSampleRate);
 
+    std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Constructed Vamp plugin, rv is " << rv << std::endl;
+
     //!!! need to dlclose() when plugins from a given library are unloaded
 
 done:
--- a/transform/TransformFactory.cpp	Thu Apr 13 18:29:10 2006 +0000
+++ b/transform/TransformFactory.cpp	Mon Apr 24 15:52:20 2006 +0000
@@ -334,6 +334,20 @@
 }
 
 bool
+TransformFactory::getChannelRange(TransformName name, Vamp::PluginBase *plugin,
+                                  int &minChannels, int &maxChannels)
+{
+    Vamp::Plugin *vp = 0;
+    if ((vp = dynamic_cast<Vamp::Plugin *>(plugin))) {
+        minChannels = vp->getMinChannelCount();
+        maxChannels = vp->getMaxChannelCount();
+        return true;
+    } else {
+        return getTransformChannelRange(name, minChannels, maxChannels);
+    }
+}
+
+bool
 TransformFactory::getConfigurationForTransform(TransformName name,
                                                Model *inputModel,
                                                int &channel,
@@ -372,7 +386,7 @@
         }
 
         int minChannels = 1, maxChannels = sourceChannels;
-        getTransformChannelRange(name, minChannels, maxChannels);
+        getChannelRange(name, plugin, minChannels, maxChannels);
 
         int targetChannels = sourceChannels;
         if (sourceChannels < minChannels) targetChannels = minChannels;
--- a/transform/TransformFactory.h	Thu Apr 13 18:29:10 2006 +0000
+++ b/transform/TransformFactory.h	Mon Apr 24 15:52:20 2006 +0000
@@ -20,6 +20,8 @@
 
 #include <map>
 
+namespace Vamp { class PluginBase; }
+
 class TransformFactory : public QObject
 {
     Q_OBJECT
@@ -143,6 +145,9 @@
     void populateFeatureExtractionPlugins(TransformDescriptionMap &);
     void populateRealTimePlugins(TransformDescriptionMap &);
 
+    bool getChannelRange(TransformName name,
+                         Vamp::PluginBase *plugin, int &min, int &max);
+
     static TransformFactory *m_instance;
 };