2 Copyright (C) 2000-2007 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_plugin_manager_h__
21 #define __ardour_plugin_manager_h__
24 #include "libardour-config.h"
31 #include <boost/utility.hpp>
33 #include "ardour/libardour_visibility.h"
34 #include "ardour/types.h"
35 #include "ardour/plugin.h"
41 class LIBARDOUR_API PluginManager : public boost::noncopyable {
43 static PluginManager& instance();
44 static std::string scanner_bin_path;
48 const ARDOUR::PluginInfoList& windows_vst_plugin_info ();
49 const ARDOUR::PluginInfoList& lxvst_plugin_info ();
50 const ARDOUR::PluginInfoList& mac_vst_plugin_info ();
51 const ARDOUR::PluginInfoList& ladspa_plugin_info ();
52 const ARDOUR::PluginInfoList& lv2_plugin_info ();
53 const ARDOUR::PluginInfoList& au_plugin_info ();
54 const ARDOUR::PluginInfoList& lua_plugin_info ();
56 void refresh (bool cache_only = false);
57 void cancel_plugin_scan();
58 void cancel_plugin_timeout();
59 void clear_vst_cache ();
60 void clear_vst_blacklist ();
61 void clear_au_cache ();
62 void clear_au_blacklist ();
64 const std::string get_default_windows_vst_path() const { return windows_vst_path; }
65 const std::string get_default_lxvst_path() const { return lxvst_path; }
67 /* always return LXVST for any VST subtype */
68 static PluginType to_generic_vst (PluginType);
70 bool cancelled () { return _cancel_scan; }
71 bool no_timeout () { return _cancel_timeout; }
73 enum PluginStatusType {
79 std::string user_plugin_metadata_dir () const;
80 void load_statuses ();
81 void save_statuses ();
82 void set_status (ARDOUR::PluginType type, std::string unique_id, PluginStatusType status);
83 PluginStatusType get_status (const PluginInfoPtr&) const;
88 void set_tags (ARDOUR::PluginType type, std::string unique_id, std::string tags, bool factory, bool force = false);
89 void reset_tags (PluginInfoPtr const&);
90 std::string get_tags_as_string (PluginInfoPtr const&) const;
91 std::vector<std::string> get_tags (PluginInfoPtr const&) const;
98 std::vector<std::string> get_all_tags (enum TagFilter) const;
100 /** plugins were added to or removed from one of the PluginInfoLists, OR the user has made changes to the status/tags */
101 PBD::Signal0<void> PluginListChanged;
103 /** A single plugin's Hidden/Favorite status changed */
104 PBD::Signal3<void, ARDOUR::PluginType, std::string, PluginStatusType> PluginStatusChanged; //PluginType t, string id, string tag
106 /** A single plugin's Tags status changed */
107 PBD::Signal3<void, ARDOUR::PluginType, std::string, std::string> PluginTagChanged; //PluginType t, string id, string tag
112 ARDOUR::PluginType type;
113 std::string unique_id;
117 PluginTag (ARDOUR::PluginType t, std::string id, std::string s, bool user_set)
118 : type (t), unique_id (id), tags (s), user_set (user_set) {}
120 bool operator== (PluginTag const& other) const {
121 return other.type == type && other.unique_id == unique_id;
124 bool operator< (PluginTag const& other) const {
125 if (other.type < type) {
127 } else if (other.type == type && other.unique_id < unique_id) {
134 typedef std::set<PluginTag> PluginTagList;
137 std::string sanitize_tag (const std::string) const;
139 struct PluginStatus {
140 ARDOUR::PluginType type;
141 std::string unique_id;
142 PluginStatusType status;
144 PluginStatus (ARDOUR::PluginType t, std::string id, PluginStatusType s = Normal)
145 : type (t), unique_id (id), status (s) {}
147 bool operator==(const PluginStatus& other) const {
148 return other.type == type && other.unique_id == unique_id;
151 bool operator<(const PluginStatus& other) const {
152 if (other.type < type) {
154 } else if (other.type == type && other.unique_id < unique_id) {
160 typedef std::set<PluginStatus> PluginStatusList;
161 PluginStatusList statuses;
163 ARDOUR::PluginInfoList _empty_plugin_info;
164 ARDOUR::PluginInfoList* _windows_vst_plugin_info;
165 ARDOUR::PluginInfoList* _lxvst_plugin_info;
166 ARDOUR::PluginInfoList* _mac_vst_plugin_info;
167 ARDOUR::PluginInfoList* _ladspa_plugin_info;
168 ARDOUR::PluginInfoList* _lv2_plugin_info;
169 ARDOUR::PluginInfoList* _au_plugin_info;
170 ARDOUR::PluginInfoList* _lua_plugin_info;
172 std::map<uint32_t, std::string> rdf_type;
174 std::string windows_vst_path;
175 std::string lxvst_path;
178 bool _cancel_timeout;
180 void ladspa_refresh ();
182 void lua_refresh_cb ();
183 void windows_vst_refresh (bool cache_only = false);
184 void mac_vst_refresh (bool cache_only = false);
185 void lxvst_refresh (bool cache_only = false);
187 void add_lrdf_data (const std::string &path);
188 void add_ladspa_presets ();
189 void add_windows_vst_presets ();
190 void add_mac_vst_presets ();
191 void add_lxvst_presets ();
192 void add_presets (std::string domain);
194 void au_refresh (bool cache_only = false);
198 int windows_vst_discover_from_path (std::string path, bool cache_only = false);
199 int windows_vst_discover (std::string path, bool cache_only = false);
201 int mac_vst_discover_from_path (std::string path, bool cache_only = false);
202 int mac_vst_discover (std::string path, bool cache_only = false);
204 int lxvst_discover_from_path (std::string path, bool cache_only = false);
205 int lxvst_discover (std::string path, bool cache_only = false);
207 int ladspa_discover (std::string path);
209 std::string get_ladspa_category (uint32_t id);
210 std::vector<uint32_t> ladspa_plugin_whitelist;
212 PBD::ScopedConnection lua_refresh_connection;
213 Glib::Threads::Mutex _lock;
215 static PluginManager* _instance; // singleton
219 } /* namespace ARDOUR */
221 #endif /* __ardour_plugin_manager_h__ */