- ComponentDescription desc;
- desc.componentFlags = 0;
- desc.componentFlagsMask = 0;
- desc.componentSubType = 0;
- desc.componentManufacturer = 0;
+int
+PluginManager::lxvst_discover (string path)
+{
+ VSTInfo* finfo;
+ char buf[32];
+
+ if ((finfo = vstfx_get_info (const_cast<char *> (path.c_str()))) == 0) {
+ return -1;
+ }
+
+ if (!finfo->canProcessReplacing) {
+ warning << string_compose (_("linuxVST plugin %1 does not support processReplacing, and so cannot be used in ardour at this time"),
+ finfo->name)
+ << endl;
+ }
+
+ PluginInfoPtr info(new LXVSTPluginInfo);
+
+ if (!strcasecmp ("The Unnamed plugin", finfo->name)) {
+ info->name = PBD::basename_nosuffix (path);
+ } else {
+ info->name = finfo->name;
+ }
+
+
+ snprintf (buf, sizeof (buf), "%d", finfo->UniqueID);
+ info->unique_id = buf;
+ info->category = "linuxVSTs";
+ info->path = path;
+ info->creator = finfo->creator;
+ info->index = 0;
+ info->n_inputs.set_audio (finfo->numInputs);
+ info->n_outputs.set_audio (finfo->numOutputs);
+ info->n_inputs.set_midi (finfo->wantMidi ? 1 : 0);
+ info->type = ARDOUR::LXVST;
+
+ /* Make sure we don't find the same plugin in more than one place along
+ the LXVST_PATH We can't use a simple 'find' because the path is included
+ in the PluginInfo, and that is the one thing we can be sure MUST be
+ different if a duplicate instance is found. So we just compare the type
+ and unique ID (which for some VSTs isn't actually unique...)
+ */
+
+ if (!_lxvst_plugin_info->empty()) {
+ for (PluginInfoList::iterator i =_lxvst_plugin_info->begin(); i != _lxvst_plugin_info->end(); ++i) {
+ if ((info->type == (*i)->type)&&(info->unique_id == (*i)->unique_id)) {
+ warning << "Ignoring duplicate Linux VST plugin " << info->name << "\n";
+ vstfx_free_info(finfo);
+ return 0;
+ }
+ }
+ }