comparison plugin/LADSPAPluginFactory.cpp @ 60:3086ff194ea0

* More structural work on feature extraction plugin C <-> C++ adapter * Allow use of LADSPA/DSSI plugins with control outputs as feature extraction plugins (DSSI with MIDI output still to come) * Reorder labels on spectrogram status box * Minor tweaks in doc etc.
author Chris Cannam
date Mon, 27 Mar 2006 15:03:02 +0000
parents 7439f1696314
children c983dda79f72
comparison
equal deleted inserted replaced
59:9705a1978ecc 60:3086ff194ea0
123 } 123 }
124 124
125 unloadUnusedLibraries(); 125 unloadUnusedLibraries();
126 } 126 }
127 127
128 const RealTimePluginDescriptor *
129 LADSPAPluginFactory::getPluginDescriptor(QString identifier) const
130 {
131 std::map<QString, RealTimePluginDescriptor *>::const_iterator i =
132 m_rtDescriptors.find(identifier);
133
134 if (i != m_rtDescriptors.end()) {
135 return i->second;
136 }
137
138 return 0;
139 }
140
128 float 141 float
129 LADSPAPluginFactory::getPortMinimum(const LADSPA_Descriptor *descriptor, int port) 142 LADSPAPluginFactory::getPortMinimum(const LADSPA_Descriptor *descriptor, int port)
130 { 143 {
131 LADSPA_PortRangeHintDescriptor d = 144 LADSPA_PortRangeHintDescriptor d =
132 descriptor->PortRangeHints[port].HintDescriptor; 145 descriptor->PortRangeHints[port].HintDescriptor;
571 const LADSPA_Descriptor *descriptor = 0; 584 const LADSPA_Descriptor *descriptor = 0;
572 585
573 int index = 0; 586 int index = 0;
574 while ((descriptor = fn(index))) { 587 while ((descriptor = fn(index))) {
575 588
589 RealTimePluginDescriptor *rtd = new RealTimePluginDescriptor;
590 rtd->name = descriptor->Name;
591 rtd->label = descriptor->Label;
592 rtd->maker = descriptor->Maker;
593 rtd->copyright = descriptor->Copyright;
594 rtd->category = "";
595 rtd->isSynth = false;
596 rtd->parameterCount = 0;
597 rtd->audioInputPortCount = 0;
598 rtd->controlOutputPortCount = 0;
599
576 #ifdef HAVE_LRDF 600 #ifdef HAVE_LRDF
577 char *def_uri = 0; 601 char *def_uri = 0;
578 lrdf_defaults *defs = 0; 602 lrdf_defaults *defs = 0;
579 603
580 QString category = m_taxonomy[descriptor->UniqueID]; 604 QString category = m_taxonomy[descriptor->UniqueID];
586 category = "VST effects"; 610 category = "VST effects";
587 m_taxonomy[descriptor->UniqueID] = category; 611 m_taxonomy[descriptor->UniqueID] = category;
588 } 612 }
589 } 613 }
590 614
615 rtd->category = category.toStdString();
616
591 // std::cerr << "Plugin id is " << descriptor->UniqueID 617 // std::cerr << "Plugin id is " << descriptor->UniqueID
592 // << ", category is \"" << (category ? category : QString("(none)")) 618 // << ", category is \"" << (category ? category : QString("(none)"))
593 // << "\", name is " << descriptor->Name 619 // << "\", name is " << descriptor->Name
594 // << ", label is " << descriptor->Label 620 // << ", label is " << descriptor->Label
595 // << std::endl; 621 // << std::endl;
619 ++controlPortNumber; 645 ++controlPortNumber;
620 } 646 }
621 } 647 }
622 #endif // HAVE_LRDF 648 #endif // HAVE_LRDF
623 649
650 for (unsigned long i = 0; i < descriptor->PortCount; i++) {
651 if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[i])) {
652 if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[i])) {
653 ++rtd->parameterCount;
654 } else {
655 if (strcmp(descriptor->PortNames[i], "latency") &&
656 strcmp(descriptor->PortNames[i], "_latency")) {
657 ++rtd->controlOutputPortCount;
658 rtd->controlOutputPortNames.push_back
659 (descriptor->PortNames[i]);
660 }
661 }
662 } else {
663 if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[i])) {
664 ++rtd->audioInputPortCount;
665 }
666 }
667 }
668
624 QString identifier = PluginIdentifier::createIdentifier 669 QString identifier = PluginIdentifier::createIdentifier
625 ("ladspa", soname, descriptor->Label); 670 ("ladspa", soname, descriptor->Label);
626 m_identifiers.push_back(identifier); 671 m_identifiers.push_back(identifier);
672
673 m_rtDescriptors[identifier] = rtd;
627 674
628 ++index; 675 ++index;
629 } 676 }
630 677
631 if (DLCLOSE(libraryHandle) != 0) { 678 if (DLCLOSE(libraryHandle) != 0) {