Update of /cvsroot/audacity/audacity-src/src/effects/ladspa
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv12813

Modified Files:
        LoadLadspa.cpp 
Log Message:
Prevent duplicate entries that might come from different directories

Index: LoadLadspa.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/ladspa/LoadLadspa.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- LoadLadspa.cpp      26 Sep 2006 10:42:58 -0000      1.24
+++ LoadLadspa.cpp      27 Sep 2006 04:52:12 -0000      1.25
@@ -18,6 +18,7 @@
 #define descriptorFnName "ladspa_descriptor"
 
 #include <wx/dynlib.h>
+#include <wx/hashmap.h>
 #include <wx/list.h>
 #include <wx/log.h>
 #include <wx/string.h>
@@ -29,7 +30,7 @@
 #include "../../Internat.h"
 #include "LadspaEffect.h"
 
-void LoadLadspaEffect(wxString fname)
+void LoadLadspaEffect(wxSortedArrayString &uniq, wxString fname)
 {
    wxLogNull logNo;
    LADSPA_Descriptor_Function mainFn = NULL;
@@ -53,9 +54,14 @@
 
       data = mainFn(index);
       while(data) {
-         LadspaEffect *effect = new LadspaEffect(data);
-         Effect::RegisterEffect(effect);
-         
+
+         wxString uniqid = wxString::Format(wxT("%08x-%s"), data->UniqueID, 
data->Label);
+         if (uniq.Index(uniqid) == wxNOT_FOUND) {
+            uniq.Add(uniqid);
+            LadspaEffect *effect = new LadspaEffect(data);
+            Effect::RegisterEffect(effect);
+         }
+            
          // Get next plugin
          index++;
          data = mainFn(index);            
@@ -70,6 +76,7 @@
    wxArrayString audacityPathList = wxGetApp().audacityPathList;
    wxArrayString pathList;
    wxArrayString files;
+   wxSortedArrayString uniq;
    wxString pathVar;
    unsigned int i;
 
@@ -105,7 +112,7 @@
    #endif
 
    for(i=0; i<files.GetCount(); i++)
-      LoadLadspaEffect(files[i]);
+      LoadLadspaEffect(uniq, files[i]);
 }
 
 // Indentation settings for Vim and Emacs and unique identifier for Arch, a


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to