diff transform/TransformFactory.cpp @ 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 2beca8ddcdc3
children 0a846f83a4b7
line wrap: on
line diff
--- 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;