diff plugin/DSSIPluginFactory.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 d397ea0a79f5
children 7afcfe666910
line wrap: on
line diff
--- a/plugin/DSSIPluginFactory.cpp	Fri Mar 24 18:15:50 2006 +0000
+++ b/plugin/DSSIPluginFactory.cpp	Mon Mar 27 15:03:02 2006 +0000
@@ -285,6 +285,18 @@
 	    continue;
 	}
 
+        RealTimePluginDescriptor *rtd = new RealTimePluginDescriptor;
+        rtd->name = ladspaDescriptor->Name;
+        rtd->label = ladspaDescriptor->Label;
+        rtd->maker = ladspaDescriptor->Maker;
+        rtd->copyright = ladspaDescriptor->Copyright;
+        rtd->category = "";
+        rtd->isSynth = (descriptor->run_synth ||
+                        descriptor->run_multiple_synths);
+        rtd->parameterCount = 0;
+        rtd->audioInputPortCount = 0;
+        rtd->controlOutputPortCount = 0;
+
 #ifdef HAVE_LRDF
 	char *def_uri = 0;
 	lrdf_defaults *defs = 0;
@@ -303,6 +315,8 @@
 		m_taxonomy[ladspaDescriptor->UniqueID] = category;
 	    }
 	}
+
+        rtd->category = category.toStdString();
 	
 //	std::cerr << "Plugin id is " << ladspaDescriptor->UniqueID
 //		  << ", category is \"" << (category ? category : QString("(none)"))
@@ -337,10 +351,31 @@
 	}
 #endif // HAVE_LRDF
 
+	for (unsigned long i = 0; i < ladspaDescriptor->PortCount; i++) {
+	    if (LADSPA_IS_PORT_CONTROL(ladspaDescriptor->PortDescriptors[i])) {
+                if (LADSPA_IS_PORT_INPUT(ladspaDescriptor->PortDescriptors[i])) {
+                    ++rtd->parameterCount;
+                } else {
+                    if (strcmp(ladspaDescriptor->PortNames[i], "latency") &&
+                        strcmp(ladspaDescriptor->PortNames[i], "_latency")) {
+                        ++rtd->controlOutputPortCount;
+                        rtd->controlOutputPortNames.push_back
+                            (ladspaDescriptor->PortNames[i]);
+                    }
+                }
+            } else {
+                if (LADSPA_IS_PORT_INPUT(ladspaDescriptor->PortDescriptors[i])) {
+                    ++rtd->audioInputPortCount;
+                }
+            }
+        }
+
 	QString identifier = PluginIdentifier::createIdentifier
 	    ("dssi", soname, ladspaDescriptor->Label);
 	m_identifiers.push_back(identifier);
 
+        m_rtDescriptors[identifier] = rtd;
+
 	++index;
     }