add dedicated API to check plugin class
authorRobin Gareus <robin@gareus.org>
Wed, 18 Nov 2015 17:11:19 +0000 (18:11 +0100)
committerRobin Gareus <robin@gareus.org>
Wed, 18 Nov 2015 17:11:19 +0000 (18:11 +0100)
libs/ardour/ardour/lv2_plugin.h
libs/ardour/ardour/plugin.h
libs/ardour/lv2_plugin.cc

index 12e079f29c71ac002058a773161f6837a2a13d6d..fcbf8b90cc84ef7be0ce4306194f2753efbd1914 100644 (file)
@@ -277,6 +277,7 @@ public:
        static PluginInfoList* discover ();
 
        PluginPtr load (Session& session);
+       virtual bool in_category (const std::string &c) const;
 
        char * _plugin_uri;
 };
index 7bef40ab88814dc28601a4e4b931bd8d45578e3b..063335ccc3f57d3620d9d58c2f306c0b0365d307 100644 (file)
@@ -68,6 +68,7 @@ class LIBARDOUR_API PluginInfo {
 
        virtual PluginPtr load (Session& session) = 0;
        virtual bool is_instrument() const;
+       virtual bool in_category (const std::string &) const { return false; }
 
        /* NOTE: this block of virtual methods looks like the interface
           to a Processor, but Plugin does not inherit from Processor.
index 2d277aa301c213306d9e7f0f5e96e9483f632e5d..47e1053a2cd36aa55f39d9d0329b0e16e9f49811 100644 (file)
@@ -2561,6 +2561,17 @@ LV2PluginInfo::load(Session& session)
        return PluginPtr();
 }
 
+bool
+LV2PluginInfo::in_category (const std::string &c) const
+{
+       // TODO use untranslated lilv_plugin_get_class()
+       // match gtk2_ardour/plugin_selector.cc
+       if (category == c) {
+               return true;
+       }
+       return false;
+}
+
 PluginInfoList*
 LV2PluginInfo::discover()
 {