changeset 353:1c6816220185

* more handy functions
author Chris Cannam
date Mon, 10 Dec 2007 17:37:13 +0000
parents f4f9c039c458
children 048b21bc9891
files plugin/transform/Transform.cpp plugin/transform/Transform.h
diffstat 2 files changed, 28 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugin/transform/Transform.cpp	Mon Dec 10 15:32:40 2007 +0000
+++ b/plugin/transform/Transform.cpp	Mon Dec 10 17:37:13 2007 +0000
@@ -176,6 +176,25 @@
     return m_id.section(':', 3);
 }
 
+void
+Transform::setPluginIdentifier(QString pluginIdentifier)
+{
+    m_id = pluginIdentifier + ':' + getOutput();
+}
+
+void
+Transform::setOutput(QString output)
+{
+    m_id = getPluginIdentifier() + ':' + output;
+}
+
+TransformId
+Transform::getIdentifierForPluginOutput(QString pluginIdentifier,
+                                        QString output)
+{
+    return pluginIdentifier + ':' + output;
+}
+
 const Transform::ParameterMap &
 Transform::getParameters() const
 {
--- a/plugin/transform/Transform.h	Mon Dec 10 15:32:40 2007 +0000
+++ b/plugin/transform/Transform.h	Mon Dec 10 17:37:13 2007 +0000
@@ -59,15 +59,21 @@
 
     void setIdentifier(TransformId id);
     TransformId getIdentifier() const;
-    
-    void setPlugin(QString pluginIdentifier);
-    void setOutput(QString output);
 
     enum Type { FeatureExtraction, RealTimeEffect };
 
     Type getType() const;
     QString getPluginIdentifier() const;
     QString getOutput() const;
+    
+    void setPluginIdentifier(QString pluginIdentifier);
+    void setOutput(QString output);
+
+    // Turn a plugin ID and output name into a transform ID.  Note
+    // that our pluginIdentifier is the same thing as the Vamp SDK's
+    // PluginLoader::PluginKey.
+    static TransformId getIdentifierForPluginOutput(QString pluginIdentifier,
+                                                    QString output = "");
 
     typedef std::map<QString, float> ParameterMap;