comparison plugin/PiperVampPluginFactory.cpp @ 1238:dd49630e0d70 piper

Merge from branch project-file-rework
author Chris Cannam
date Fri, 28 Oct 2016 15:19:12 +0100
parents fe391a7b8376
children 42a4b058f8ba
comparison
equal deleted inserted replaced
1229:e699bdeef63c 1238:dd49630e0d70
51 { 51 {
52 // Server must exist either in the same directory as this one or 52 // Server must exist either in the same directory as this one or
53 // (preferably) a subdirectory called "piper-bin". 53 // (preferably) a subdirectory called "piper-bin".
54 //!!! todo: merge this with plugin scan checker thingy used in main.cpp? 54 //!!! todo: merge this with plugin scan checker thingy used in main.cpp?
55 QString myDir = QCoreApplication::applicationDirPath(); 55 QString myDir = QCoreApplication::applicationDirPath();
56 QString name = "piper-vamp-server"; 56 QString name = "piper-vamp-simple-server";
57 QString path = myDir + "/piper-bin/" + name; 57 QString path = myDir + "/piper-bin/" + name;
58 QString suffix = ""; 58 QString suffix = "";
59 #ifdef _WIN32 59 #ifdef _WIN32
60 suffix = ".exe"; 60 suffix = ".exe";
61 #endif 61 #endif
141 void 141 void
142 PiperVampPluginFactory::populate(QString &errorMessage) 142 PiperVampPluginFactory::populate(QString &errorMessage)
143 { 143 {
144 if (m_serverName == "") return; 144 if (m_serverName == "") return;
145 145
146 piper_vamp::client::ProcessQtTransport transport(m_serverName); 146 piper_vamp::client::ProcessQtTransport transport(m_serverName, "capnp");
147 if (!transport.isOK()) { 147 if (!transport.isOK()) {
148 errorMessage = QObject::tr("Could not start external plugin host"); 148 errorMessage = QObject::tr("Could not start external plugin host");
149 return; 149 return;
150 } 150 }
151 151
152 piper_vamp::client::CapnpRRClient client(&transport); 152 piper_vamp::client::CapnpRRClient client(&transport);
153 piper_vamp::ListResponse lr = client.listPluginData(); 153 piper_vamp::ListResponse lr;
154
155 try {
156 lr = client.listPluginData();
157 } catch (piper_vamp::client::ServerCrashed) {
158 errorMessage = QObject::tr
159 ("External plugin host exited unexpectedly while listing plugins");
160 return;
161 } catch (const std::exception &e) {
162 errorMessage = QObject::tr("External plugin host invocation failed: %1")
163 .arg(e.what());
164 return;
165 }
154 166
155 for (const auto &pd: lr.available) { 167 for (const auto &pd: lr.available) {
156 168
157 QString identifier = 169 QString identifier =
158 QString("vamp:") + QString::fromStdString(pd.pluginKey); 170 QString("vamp:") + QString::fromStdString(pd.pluginKey);