comparison plugin/PiperVampPluginFactory.cpp @ 1247:8f076d02569a piper

Make SVDEBUG always write to a log file -- formerly this was disabled in NDEBUG builds. I think there's little use to that, it just means that we keep adding more cerr debug output because we aren't getting the log we need. And SVDEBUG logging is not usually used in tight loops, I don't think the performance overhead is too serious. Also update the About box.
author Chris Cannam
date Thu, 03 Nov 2016 14:57:00 +0000
parents 75aefcc9f07d
children 58dd6a6fe414
comparison
equal deleted inserted replaced
1246:75aefcc9f07d 1247:8f076d02569a
52 52
53 HelperExecPath hep(HelperExecPath::AllInstalled); 53 HelperExecPath hep(HelperExecPath::AllInstalled);
54 m_servers = hep.getHelperExecutables(serverName); 54 m_servers = hep.getHelperExecutables(serverName);
55 55
56 for (auto n: m_servers) { 56 for (auto n: m_servers) {
57 cerr << "NOTE: PiperVampPluginFactory: Found server: " 57 SVDEBUG << "NOTE: PiperVampPluginFactory: Found server: "
58 << n.executable << endl; 58 << n.executable << endl;
59 } 59 }
60 60
61 if (m_servers.empty()) { 61 if (m_servers.empty()) {
62 cerr << "NOTE: No Piper Vamp servers found in installation;" 62 SVDEBUG << "NOTE: No Piper Vamp servers found in installation;"
63 << " found none of the following:" << endl; 63 << " found none of the following:" << endl;
64 for (auto d: hep.getHelperCandidatePaths(serverName)) { 64 for (auto d: hep.getHelperCandidatePaths(serverName)) {
65 cerr << "NOTE: " << d << endl; 65 SVDEBUG << "NOTE: " << d << endl;
66 } 66 }
67 } 67 }
68 } 68 }
69 69
70 vector<QString> 70 vector<QString>
98 { 98 {
99 Profiler profiler("PiperVampPluginFactory::instantiatePlugin"); 99 Profiler profiler("PiperVampPluginFactory::instantiatePlugin");
100 100
101 if (m_origins.find(identifier) == m_origins.end()) { 101 if (m_origins.find(identifier) == m_origins.end()) {
102 cerr << "ERROR: No known server for identifier " << identifier << endl; 102 cerr << "ERROR: No known server for identifier " << identifier << endl;
103 SVDEBUG << "ERROR: No known server for identifier " << identifier << endl;
103 return 0; 104 return 0;
104 } 105 }
105 106
106 auto psd = getPluginStaticData(identifier); 107 auto psd = getPluginStaticData(identifier);
107 if (psd.pluginKey == "") { 108 if (psd.pluginKey == "") {
168 169
169 vector<string> from; 170 vector<string> from;
170 for (const auto &c: candidateLibraries) { 171 for (const auto &c: candidateLibraries) {
171 if (c.helperTag == tag) { 172 if (c.helperTag == tag) {
172 string soname = QFileInfo(c.libraryPath).baseName().toStdString(); 173 string soname = QFileInfo(c.libraryPath).baseName().toStdString();
173 cerr << "INFO: For tag \"" << tag << "\" giving library " << soname << endl; 174 SVDEBUG << "INFO: For tag \"" << tag << "\" giving library " << soname << endl;
174 from.push_back(soname); 175 from.push_back(soname);
175 } 176 }
176 } 177 }
177 178
178 if (from.empty()) { 179 if (from.empty()) {
179 cerr << "PiperVampPluginFactory: No candidate libraries for tag \"" 180 SVDEBUG << "PiperVampPluginFactory: No candidate libraries for tag \""
180 << tag << "\""; 181 << tag << "\"";
181 if (scan->scanSucceeded()) { 182 if (scan->scanSucceeded()) {
182 // we have to assume that they all failed to load (i.e. we 183 // we have to assume that they all failed to load (i.e. we
183 // exclude them all) rather than sending an empty list 184 // exclude them all) rather than sending an empty list
184 // (which would mean no exclusions) 185 // (which would mean no exclusions)
185 cerr << ", skipping" << endl; 186 SVDEBUG << ", skipping" << endl;
186 return; 187 return;
187 } else { 188 } else {
188 cerr << ", but it seems the scan failed, so bumbling on anyway" << endl; 189 SVDEBUG << ", but it seems the scan failed, so bumbling on anyway" << endl;
189 } 190 }
190 } 191 }
191 192
192 piper_vamp::client::ProcessQtTransport transport(executable, "capnp"); 193 piper_vamp::client::ProcessQtTransport transport(executable, "capnp");
193 if (!transport.isOK()) { 194 if (!transport.isOK()) {
208 errorMessage = QObject::tr("External plugin host invocation failed: %1") 209 errorMessage = QObject::tr("External plugin host invocation failed: %1")
209 .arg(e.what()); 210 .arg(e.what());
210 return; 211 return;
211 } 212 }
212 213
213 cerr << "PiperVampPluginFactory: server \"" << executable << "\" lists " 214 SVDEBUG << "PiperVampPluginFactory: server \"" << executable << "\" lists "
214 << lr.available.size() << " plugin(s)" << endl; 215 << lr.available.size() << " plugin(s)" << endl;
215 216
216 for (const auto &pd: lr.available) { 217 for (const auto &pd: lr.available) {
217 218
218 QString identifier = 219 QString identifier =
219 QString("vamp:") + QString::fromStdString(pd.pluginKey); 220 QString("vamp:") + QString::fromStdString(pd.pluginKey);