comparison transform/TransformFactory.cpp @ 108:58f21cf235c7

* Further fixes for Vamp API change, and update to support API versioning * Add plugin, output and parameter descriptions to GUI * Avoid squished panner in heads-up-display on pane when time-value or note layer is on top
author Chris Cannam
date Tue, 27 Feb 2007 12:51:38 +0000
parents dd11619b73ba
children b4110b17bca8
comparison
equal deleted inserted replaced
107:dd11619b73ba 108:58f21cf235c7
242 .arg(pluginId).arg(outputs[j].identifier.c_str()); 242 .arg(pluginId).arg(outputs[j].identifier.c_str());
243 243
244 QString userName; 244 QString userName;
245 QString friendlyName; 245 QString friendlyName;
246 QString units = outputs[j].unit.c_str(); 246 QString units = outputs[j].unit.c_str();
247 QString description = plugin->getDescription().c_str();
248 QString maker = plugin->getMaker().c_str();
249 if (maker == "") maker = tr("<unknown maker>");
250
251 if (description == "") {
252 if (outputs.size() == 1) {
253 description = tr("Extract features using \"%1\" plugin (from %2)")
254 .arg(pluginName).arg(maker);
255 } else {
256 description = tr("Extract features using \"%1\" output of \"%2\" plugin (from %3)")
257 .arg(outputs[j].name.c_str()).arg(pluginName).arg(maker);
258 }
259 } else {
260 if (outputs.size() == 1) {
261 description = tr("%1 using \"%2\" plugin (from %3)")
262 .arg(description).arg(pluginName).arg(maker);
263 } else {
264 description = tr("%1 using \"%2\" output of \"%3\" plugin (from %4)")
265 .arg(description).arg(outputs[j].name.c_str()).arg(pluginName).arg(maker);
266 }
267 }
247 268
248 if (outputs.size() == 1) { 269 if (outputs.size() == 1) {
249 userName = pluginName; 270 userName = pluginName;
250 friendlyName = pluginName; 271 friendlyName = pluginName;
251 } else { 272 } else {
264 TransformDesc(tr("Analysis"), 285 TransformDesc(tr("Analysis"),
265 category, 286 category,
266 transformId, 287 transformId,
267 userName, 288 userName,
268 friendlyName, 289 friendlyName,
269 plugin->getMaker().c_str(), 290 description,
291 maker,
270 units, 292 units,
271 configurable); 293 configurable);
272 } 294 }
273 } 295 }
274 } 296 }
307 // std::cout << "TransformFactory::populateRealTimePlugins: plugin " << pluginId.toStdString() << " has " << descriptor->controlOutputPortCount << " control output ports, " << descriptor->audioOutputPortCount << " audio outputs, " << descriptor->audioInputPortCount << " audio inputs" << std::endl; 329 // std::cout << "TransformFactory::populateRealTimePlugins: plugin " << pluginId.toStdString() << " has " << descriptor->controlOutputPortCount << " control output ports, " << descriptor->audioOutputPortCount << " audio outputs, " << descriptor->audioInputPortCount << " audio inputs" << std::endl;
308 330
309 QString pluginName = descriptor->name.c_str(); 331 QString pluginName = descriptor->name.c_str();
310 QString category = factory->getPluginCategory(pluginId); 332 QString category = factory->getPluginCategory(pluginId);
311 bool configurable = (descriptor->parameterCount > 0); 333 bool configurable = (descriptor->parameterCount > 0);
334 QString maker = descriptor->maker.c_str();
335 if (maker == "") maker = tr("<unknown maker>");
312 336
313 if (descriptor->audioInputPortCount > 0) { 337 if (descriptor->audioInputPortCount > 0) {
314 338
315 for (size_t j = 0; j < descriptor->controlOutputPortCount; ++j) { 339 for (size_t j = 0; j < descriptor->controlOutputPortCount; ++j) {
316 340
317 QString transformId = QString("%1:%2").arg(pluginId).arg(j); 341 QString transformId = QString("%1:%2").arg(pluginId).arg(j);
318 QString userName; 342 QString userName;
319 QString units; 343 QString units;
344 QString portName;
320 345
321 if (j < descriptor->controlOutputPortNames.size() && 346 if (j < descriptor->controlOutputPortNames.size() &&
322 descriptor->controlOutputPortNames[j] != "") { 347 descriptor->controlOutputPortNames[j] != "") {
323 348
324 QString portName = descriptor->controlOutputPortNames[j].c_str(); 349 portName = descriptor->controlOutputPortNames[j].c_str();
325 350
326 userName = tr("%1: %2") 351 userName = tr("%1: %2")
327 .arg(pluginName) 352 .arg(pluginName)
328 .arg(portName); 353 .arg(portName);
329 354
340 } else { 365 } else {
341 366
342 userName = pluginName; 367 userName = pluginName;
343 } 368 }
344 369
370 QString description;
371
372 if (portName != "") {
373 description = tr("Extract \"%1\" data output from \"%2\" effect plugin (from %3)")
374 .arg(portName)
375 .arg(pluginName)
376 .arg(maker);
377 } else {
378 description = tr("Extract data output %1 from \"%2\" effect plugin (from %3)")
379 .arg(j + 1)
380 .arg(pluginName)
381 .arg(maker);
382 }
345 383
346 transforms[transformId] = 384 transforms[transformId] =
347 TransformDesc(tr("Effects Data"), 385 TransformDesc(tr("Effects Data"),
348 category, 386 category,
349 transformId, 387 transformId,
350 userName, 388 userName,
351 userName, 389 userName,
352 descriptor->maker.c_str(), 390 description,
391 maker,
353 units, 392 units,
354 configurable); 393 configurable);
355 } 394 }
356 } 395 }
357 396
359 398
360 if (descriptor->audioOutputPortCount > 0) { 399 if (descriptor->audioOutputPortCount > 0) {
361 400
362 QString transformId = QString("%1:A").arg(pluginId); 401 QString transformId = QString("%1:A").arg(pluginId);
363 QString type = tr("Effects"); 402 QString type = tr("Effects");
403
404 QString description = tr("Transform audio signal with \"%1\" effect plugin (from %2)")
405 .arg(pluginName)
406 .arg(maker);
407
364 if (descriptor->audioInputPortCount == 0) { 408 if (descriptor->audioInputPortCount == 0) {
365 type = tr("Generators"); 409 type = tr("Generators");
410 QString description = tr("Generate audio signal using \"%1\" plugin (from %2)")
411 .arg(pluginName)
412 .arg(maker);
366 } 413 }
367 414
368 transforms[transformId] = 415 transforms[transformId] =
369 TransformDesc(type, 416 TransformDesc(type,
370 category, 417 category,
371 transformId, 418 transformId,
372 pluginName, 419 pluginName,
373 pluginName, 420 pluginName,
374 descriptor->maker.c_str(), 421 description,
422 maker,
375 "", 423 "",
376 configurable); 424 configurable);
377 } 425 }
378 } 426 }
379 } 427 }
488 } 536 }
489 537
490 QString id = identifier.section(':', 0, 2); 538 QString id = identifier.section(':', 0, 2);
491 QString output = identifier.section(':', 3); 539 QString output = identifier.section(':', 3);
492 QString outputLabel = ""; 540 QString outputLabel = "";
541 QString outputDescription = "";
493 542
494 bool ok = false; 543 bool ok = false;
495 configurationXml = m_lastConfigurations[identifier]; 544 configurationXml = m_lastConfigurations[identifier];
496 545
497 // std::cerr << "last configuration: " << configurationXml.toStdString() << std::endl; 546 // std::cerr << "last configuration: " << configurationXml.toStdString() << std::endl;
517 vp->getOutputDescriptors(); 566 vp->getOutputDescriptors();
518 if (od.size() > 1) { 567 if (od.size() > 1) {
519 for (size_t i = 0; i < od.size(); ++i) { 568 for (size_t i = 0; i < od.size(); ++i) {
520 if (od[i].identifier == output.toStdString()) { 569 if (od[i].identifier == output.toStdString()) {
521 outputLabel = od[i].name.c_str(); 570 outputLabel = od[i].name.c_str();
571 outputDescription = od[i].description.c_str();
522 break; 572 break;
523 } 573 }
524 } 574 }
525 } 575 }
526 } 576 }
600 if (targetChannels > 0) { 650 if (targetChannels > 0) {
601 dialog->setChannelArrangement(sourceChannels, targetChannels, 651 dialog->setChannelArrangement(sourceChannels, targetChannels,
602 defaultChannel); 652 defaultChannel);
603 } 653 }
604 654
605 dialog->setOutputLabel(outputLabel); 655 dialog->setOutputLabel(outputLabel, outputDescription);
606 656
607 dialog->setShowProcessingOptions(true, frequency); 657 dialog->setShowProcessingOptions(true, frequency);
608 658
609 if (dialog->exec() == QDialog::Accepted) { 659 if (dialog->exec() == QDialog::Accepted) {
610 ok = true; 660 ok = true;