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

Modified Files:
        LoadLV2.cpp 
Log Message:
Filter out unsupported LV2 plugins

Index: LoadLV2.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/lv2/LoadLV2.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- LoadLV2.cpp 4 Jul 2008 09:56:02 -0000       1.1
+++ LoadLV2.cpp 12 Jul 2008 07:22:01 -0000      1.2
@@ -43,7 +43,27 @@
 SLV2Value gOutputPortClass;
 
 
+/** This function determines whether a plugin should be displayed or not.
+    It checks if the required features and non-optional port types are
+    supported. */
 static bool PluginFilter(SLV2Plugin plug) {
+   
+   // We don't support any features at all, so if the plugin requires
+   // any we skip it.
+   SLV2Values req = slv2_plugin_get_required_features(plug);
+   if (slv2_values_size(req) > 0)
+      return false;
+   
+   // We only understand audio and control ports, so if there are any others
+   // we skip the plugin.
+   uint32_t nPorts = slv2_plugin_get_num_ports(plug);
+   for (uint32_t i = 0; i < nPorts; ++i) {
+      SLV2Port port = slv2_plugin_get_port_at_index(plug, i);
+      if (!slv2_port_is_a(mData, port, gAudioPortClass) &&
+          !slv2_port_is_a(mData, port, gControlPortClass))
+         return false;
+   }
+   
    return true;
 }
 
@@ -87,9 +107,6 @@
             em.AddCategoryParent(chCat, pCat);
          }
       }
-      // XXX this doesn't seem to be declared, but we need to free the list
-      // somehow or it will leak - SLV2 bug?
-      //slv2_plugin_classes_free(ch);
    }
 
 #endif


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to