do not crash when loading old history files with MIDI edits; add all notes in region...
[ardour.git] / libs / ardour / plugin_manager.cc
index c665c7212669eafbd11537f8e733bcd98ba8bd5d..bdc4d9e9b5f31459addb69b97ec7c565400a0965 100644 (file)
 
 */
 
+#ifdef WAF_BUILD
+#include "libardour-config.h"
+#endif
+
 #define __STDC_FORMAT_MACROS 1
 #include <stdint.h>
 
@@ -76,7 +80,7 @@ PluginManager::PluginManager ()
 
        load_favorites ();
 
-#ifdef GTKOSX
+#ifdef HAVE_AUDIOUNITS
        ProcessSerialNumber psn = { 0, kCurrentProcess }; 
        OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication);
        if( returnCode != 0) {
@@ -209,7 +213,7 @@ PluginManager::add_ladspa_directory (string path)
        return -1;
 }
 
-static bool ladspa_filter (const string& str, void *arg)
+static bool ladspa_filter (const string& str, void */*arg*/)
 {
        /* Not a dotfile, has a prefix before a period, suffix is "so" */
        
@@ -217,7 +221,7 @@ static bool ladspa_filter (const string& str, void *arg)
 }
 
 int
-PluginManager::ladspa_discover_from_path (string path)
+PluginManager::ladspa_discover_from_path (string /*path*/)
 {
        PathScanner scanner;
        vector<string *> *plugin_objects;
@@ -236,7 +240,7 @@ PluginManager::ladspa_discover_from_path (string path)
        return ret;
 }
 
-static bool rdf_filter (const string &str, void *arg)
+static bool rdf_filter (const string &str, void */*arg*/)
 {
        return str[0] != '.' && 
                   ((str.find(".rdf")  == (str.length() - 4)) ||
@@ -364,7 +368,23 @@ PluginManager::ladspa_discover (string path)
                        }
                }
 
-               _ladspa_plugin_info.push_back (info);
+               if(_ladspa_plugin_info.empty()){
+                       _ladspa_plugin_info.push_back (info);
+               }
+
+               //Ensure that the plugin is not already in the plugin list.
+
+               bool found = false;
+
+               for (PluginInfoList::const_iterator i = _ladspa_plugin_info.begin(); i != _ladspa_plugin_info.end(); ++i) {
+                       if(0 == info->unique_id.compare((*i)->unique_id)){
+                             found = true;
+                       }
+               }
+
+               if(!found){
+                   _ladspa_plugin_info.push_back (info);
+               }
        }
 
 // GDB WILL NOT LIKE YOU IF YOU DO THIS
@@ -528,8 +548,8 @@ PluginManager::vst_discover (string path)
        info->path = path;
        info->creator = finfo->creator;
        info->index = 0;
-       info->n_inputs = finfo->numInputs;
-       info->n_outputs = finfo->numOutputs;
+       info->n_inputs.set_audio (finfo->numInputs);
+       info->n_outputs.set_audio (finfo->numOutputs);
        info->type = ARDOUR::VST;
        
        _vst_plugin_info.push_back (info);