diff plugin/FeatureExtractionPluginFactory.cpp @ 1210:584b2d7d7cd9 piper

Try AutoPlugin; also not very successful
author Chris Cannam
date Fri, 14 Oct 2016 16:23:04 +0100
parents 385deb828b4a
children 8dc7ab20e847
line wrap: on
line diff
--- a/plugin/FeatureExtractionPluginFactory.cpp	Fri Oct 14 14:33:43 2016 +0100
+++ b/plugin/FeatureExtractionPluginFactory.cpp	Fri Oct 14 16:23:04 2016 +0100
@@ -23,6 +23,8 @@
 
 #include "PluginScan.h"
 
+#include "vamp-client/AutoPlugin.h"
+
 #include <QDir>
 #include <QFile>
 #include <QFileInfo>
@@ -61,7 +63,8 @@
 }
 
 FeatureExtractionPluginFactory::FeatureExtractionPluginFactory() :
-    m_transport("piper-cpp/bin/piper-vamp-server"),
+    m_serverName("piper-cpp/bin/piper-vamp-server"),
+    m_transport(m_serverName),
     m_client(&m_transport)
 {
 }
@@ -112,17 +115,20 @@
 						  sv_samplerate_t inputSampleRate)
 {
     Profiler profiler("FeatureExtractionPluginFactory::instantiatePlugin");
-
+    
     QString type, soname, label;
     PluginIdentifier::parseIdentifier(identifier, type, soname, label);
+    std::string pluginKey = (soname + ":" + label).toStdString();
 
-    piper_vamp::LoadRequest request;
-    request.pluginKey = (soname + ":" + label).toStdString();
-    request.inputSampleRate = inputSampleRate;
-    request.adapterFlags = 0;
-    piper_vamp::LoadResponse response = m_client.loadPlugin(request);
+    auto ap = new piper_vamp::client::AutoPlugin
+        (m_serverName, pluginKey, inputSampleRate, 0);
 
-    return response.plugin;
+    if (!ap->isOK()) {
+        delete ap;
+        return 0;
+    } else {
+        return ap;
+    }
 }
 
 QString