comparison 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
comparison
equal deleted inserted replaced
1209:385deb828b4a 1210:584b2d7d7cd9
20 #include <vamp-hostsdk/PluginWrapper.h> 20 #include <vamp-hostsdk/PluginWrapper.h>
21 21
22 #include "system/System.h" 22 #include "system/System.h"
23 23
24 #include "PluginScan.h" 24 #include "PluginScan.h"
25
26 #include "vamp-client/AutoPlugin.h"
25 27
26 #include <QDir> 28 #include <QDir>
27 #include <QFile> 29 #include <QFile>
28 #include <QFileInfo> 30 #include <QFileInfo>
29 #include <QTextStream> 31 #include <QTextStream>
59 PluginIdentifier::parseIdentifier(identifier, type, soName, label); 61 PluginIdentifier::parseIdentifier(identifier, type, soName, label);
60 return instance(type); 62 return instance(type);
61 } 63 }
62 64
63 FeatureExtractionPluginFactory::FeatureExtractionPluginFactory() : 65 FeatureExtractionPluginFactory::FeatureExtractionPluginFactory() :
64 m_transport("piper-cpp/bin/piper-vamp-server"), 66 m_serverName("piper-cpp/bin/piper-vamp-server"),
67 m_transport(m_serverName),
65 m_client(&m_transport) 68 m_client(&m_transport)
66 { 69 {
67 } 70 }
68 71
69 vector<QString> 72 vector<QString>
110 Vamp::Plugin * 113 Vamp::Plugin *
111 FeatureExtractionPluginFactory::instantiatePlugin(QString identifier, 114 FeatureExtractionPluginFactory::instantiatePlugin(QString identifier,
112 sv_samplerate_t inputSampleRate) 115 sv_samplerate_t inputSampleRate)
113 { 116 {
114 Profiler profiler("FeatureExtractionPluginFactory::instantiatePlugin"); 117 Profiler profiler("FeatureExtractionPluginFactory::instantiatePlugin");
115 118
116 QString type, soname, label; 119 QString type, soname, label;
117 PluginIdentifier::parseIdentifier(identifier, type, soname, label); 120 PluginIdentifier::parseIdentifier(identifier, type, soname, label);
121 std::string pluginKey = (soname + ":" + label).toStdString();
118 122
119 piper_vamp::LoadRequest request; 123 auto ap = new piper_vamp::client::AutoPlugin
120 request.pluginKey = (soname + ":" + label).toStdString(); 124 (m_serverName, pluginKey, inputSampleRate, 0);
121 request.inputSampleRate = inputSampleRate;
122 request.adapterFlags = 0;
123 piper_vamp::LoadResponse response = m_client.loadPlugin(request);
124 125
125 return response.plugin; 126 if (!ap->isOK()) {
127 delete ap;
128 return 0;
129 } else {
130 return ap;
131 }
126 } 132 }
127 133
128 QString 134 QString
129 FeatureExtractionPluginFactory::getPluginCategory(QString identifier) 135 FeatureExtractionPluginFactory::getPluginCategory(QString identifier)
130 { 136 {