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 ARDOUR::PluginInfoList &windows_vst_plugin_info ();
49 ARDOUR::PluginInfoList &lxvst_plugin_info ();
50 ARDOUR::PluginInfoList &ladspa_plugin_info ();
51 ARDOUR::PluginInfoList &lv2_plugin_info ();
52 ARDOUR::PluginInfoList &au_plugin_info ();
53 ARDOUR::PluginInfoList &lua_plugin_info ();
55 void refresh (bool cache_only = false);
56 void cancel_plugin_scan();
57 void cancel_plugin_timeout();
58 void clear_vst_cache ();
59 void clear_vst_blacklist ();
60 void clear_au_cache ();
61 void clear_au_blacklist ();
63 const std::string get_default_windows_vst_path() const { return windows_vst_path; }
64 const std::string get_default_lxvst_path() const { return lxvst_path; }
66 bool cancelled () { return _cancel_scan; }
67 bool no_timeout () { return _cancel_timeout; }
69 enum PluginStatusType {
75 void load_statuses ();
76 void save_statuses ();
77 void set_status (ARDOUR::PluginType type, std::string unique_id, PluginStatusType status);
78 PluginStatusType get_status (const PluginInfoPtr&);
80 /** plugins were added to or removed from one of the PluginInfoLists */
81 PBD::Signal0<void> PluginListChanged;
82 /** Plugin Hidden/Favorite status changed */
83 PBD::Signal0<void> PluginStatusesChanged;
87 ARDOUR::PluginType type;
88 std::string unique_id;
89 PluginStatusType status;
91 PluginStatus (ARDOUR::PluginType t, std::string id, PluginStatusType s = Normal)
92 : type (t), unique_id (id), status (s) {}
94 bool operator==(const PluginStatus& other) const {
95 return other.type == type && other.unique_id == unique_id;
98 bool operator<(const PluginStatus& other) const {
99 if (other.type < type) {
101 } else if (other.type == type && other.unique_id < unique_id) {
107 typedef std::set<PluginStatus> PluginStatusList;
108 PluginStatusList statuses;
110 ARDOUR::PluginInfoList _empty_plugin_info;
111 ARDOUR::PluginInfoList* _windows_vst_plugin_info;
112 ARDOUR::PluginInfoList* _lxvst_plugin_info;
113 ARDOUR::PluginInfoList* _ladspa_plugin_info;
114 ARDOUR::PluginInfoList* _lv2_plugin_info;
115 ARDOUR::PluginInfoList* _au_plugin_info;
116 ARDOUR::PluginInfoList* _lua_plugin_info;
118 std::map<uint32_t, std::string> rdf_type;
120 std::string windows_vst_path;
121 std::string lxvst_path;
124 bool _cancel_timeout;
126 void ladspa_refresh ();
128 void lua_refresh_cb ();
129 void windows_vst_refresh (bool cache_only = false);
130 void lxvst_refresh (bool cache_only = false);
132 void add_lrdf_data (const std::string &path);
133 void add_ladspa_presets ();
134 void add_windows_vst_presets ();
135 void add_lxvst_presets ();
136 void add_presets (std::string domain);
138 void au_refresh (bool cache_only = false);
142 int windows_vst_discover_from_path (std::string path, bool cache_only = false);
143 int windows_vst_discover (std::string path, bool cache_only = false);
145 int lxvst_discover_from_path (std::string path, bool cache_only = false);
146 int lxvst_discover (std::string path, bool cache_only = false);
148 int ladspa_discover (std::string path);
150 std::string get_ladspa_category (uint32_t id);
151 std::vector<uint32_t> ladspa_plugin_whitelist;
153 PBD::ScopedConnection lua_refresh_connection;
154 Glib::Threads::Mutex _lock;
156 static PluginManager* _instance; // singleton
160 } /* namespace ARDOUR */
162 #endif /* __ardour_plugin_manager_h__ */