diff transform/TransformFactory.cpp @ 73:e200055fe80b

* Add vertical zooming and snap-to-selection for OSC control; add a demo script
author Chris Cannam
date Wed, 15 Nov 2006 18:22:26 +0000
parents f7cb156508cc
children bedc7517b6e8
line wrap: on
line diff
--- a/transform/TransformFactory.cpp	Tue Nov 14 16:06:00 2006 +0000
+++ b/transform/TransformFactory.cpp	Wed Nov 15 18:22:26 2006 +0000
@@ -623,6 +623,27 @@
     return ok ? inputModel : 0;
 }
 
+PluginTransform::ExecutionContext
+TransformFactory::getDefaultContextForTransform(TransformName name,
+                                                Model *inputModel)
+{
+    PluginTransform::ExecutionContext context(-1);
+
+    QString id = name.section(':', 0, 2);
+
+    if (FeatureExtractionPluginFactory::instanceFor(id)) {
+
+        Vamp::Plugin *vp =
+            FeatureExtractionPluginFactory::instanceFor(id)->instantiatePlugin
+            (id, inputModel ? inputModel->getSampleRate() : 48000);
+
+        if (vp) context = PluginTransform::ExecutionContext(-1, vp);
+
+    }
+
+    return context;
+}
+
 Transform *
 TransformFactory::createTransform(TransformName name, Model *inputModel,
                                   const PluginTransform::ExecutionContext &context,