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 ();
54 void refresh (bool cache_only = false);
55 void cancel_plugin_scan();
56 void cancel_plugin_timeout();
57 void clear_vst_cache ();
58 void clear_vst_blacklist ();
59 void clear_au_cache ();
60 void clear_au_blacklist ();
62 const std::string get_default_windows_vst_path() const { return windows_vst_path; }
63 const std::string get_default_lxvst_path() const { return lxvst_path; }
65 bool cancelled () { return _cancel_scan; }
66 bool no_timeout () { return _cancel_timeout; }
68 enum PluginStatusType {
74 void load_statuses ();
75 void save_statuses ();
76 void set_status (ARDOUR::PluginType type, std::string unique_id, PluginStatusType status);
77 PluginStatusType get_status (const PluginInfoPtr&);
79 /** plugins were added to or removed from one of the PluginInfoLists */
80 PBD::Signal0<void> PluginListChanged;
84 ARDOUR::PluginType type;
85 std::string unique_id;
86 PluginStatusType status;
88 PluginStatus (ARDOUR::PluginType t, std::string id, PluginStatusType s = Normal)
89 : type (t), unique_id (id), status (s) {}
91 bool operator==(const PluginStatus& other) const {
92 return other.type == type && other.unique_id == unique_id;
95 bool operator<(const PluginStatus& other) const {
96 if (other.type < type) {
98 } else if (other.type == type && other.unique_id < unique_id) {
104 typedef std::set<PluginStatus> PluginStatusList;
105 PluginStatusList statuses;
107 ARDOUR::PluginInfoList _empty_plugin_info;
108 ARDOUR::PluginInfoList* _windows_vst_plugin_info;
109 ARDOUR::PluginInfoList* _lxvst_plugin_info;
110 ARDOUR::PluginInfoList* _ladspa_plugin_info;
111 ARDOUR::PluginInfoList* _lv2_plugin_info;
112 ARDOUR::PluginInfoList* _au_plugin_info;
114 std::map<uint32_t, std::string> rdf_type;
116 std::string windows_vst_path;
117 std::string lxvst_path;
120 bool _cancel_timeout;
122 void ladspa_refresh ();
123 void windows_vst_refresh (bool cache_only = false);
124 void lxvst_refresh (bool cache_only = false);
126 void add_lrdf_data (const std::string &path);
127 void add_ladspa_presets ();
128 void add_windows_vst_presets ();
129 void add_lxvst_presets ();
130 void add_presets (std::string domain);
132 void au_refresh (bool cache_only = false);
136 int windows_vst_discover_from_path (std::string path, bool cache_only = false);
137 int windows_vst_discover (std::string path, bool cache_only = false);
139 int lxvst_discover_from_path (std::string path, bool cache_only = false);
140 int lxvst_discover (std::string path, bool cache_only = false);
142 int ladspa_discover (std::string path);
144 std::string get_ladspa_category (uint32_t id);
145 std::vector<uint32_t> ladspa_plugin_whitelist;
147 Glib::Threads::Mutex _lock;
149 static PluginManager* _instance; // singleton
153 } /* namespace ARDOUR */
155 #endif /* __ardour_plugin_manager_h__ */