ardour
plugin_manager.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000-2007 Paul Davis
3 
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.
8 
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.
13 
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.
17 
18 */
19 
20 #ifndef __ardour_plugin_manager_h__
21 #define __ardour_plugin_manager_h__
22 
23 #ifdef WAF_BUILD
24 #include "libardour-config.h"
25 #endif
26 
27 #include <list>
28 #include <map>
29 #include <string>
30 #include <set>
31 #include <boost/utility.hpp>
32 
34 #include "ardour/types.h"
35 #include "ardour/plugin.h"
36 
37 namespace ARDOUR {
38 
39 class Plugin;
40 
41 class LIBARDOUR_API PluginManager : public boost::noncopyable {
42  public:
43  static PluginManager& instance();
44  static std::string scanner_bin_path;
45 
46  ~PluginManager ();
47 
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 
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 ();
61 
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; }
64 
65  bool cancelled () { return _cancel_scan; }
66  bool no_timeout () { return _cancel_timeout; }
67 
69  Normal = 0,
71  Hidden
72  };
73 
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&);
78 
80  PBD::Signal0<void> PluginListChanged;
81 
82  private:
83  struct PluginStatus {
85  std::string unique_id;
87 
89  : type (t), unique_id (id), status (s) {}
90 
91  bool operator==(const PluginStatus& other) const {
92  return other.type == type && other.unique_id == unique_id;
93  }
94 
95  bool operator<(const PluginStatus& other) const {
96  if (other.type < type) {
97  return true;
98  } else if (other.type == type && other.unique_id < unique_id) {
99  return true;
100  }
101  return false;
102  }
103  };
104  typedef std::set<PluginStatus> PluginStatusList;
105  PluginStatusList statuses;
106 
113 
114  std::map<uint32_t, std::string> rdf_type;
115 
116  std::string windows_vst_path;
117  std::string lxvst_path;
118 
121 
122  void ladspa_refresh ();
123  void windows_vst_refresh (bool cache_only = false);
124  void lxvst_refresh (bool cache_only = false);
125 
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);
131 
132  void au_refresh (bool cache_only = false);
133 
134  void lv2_refresh ();
135 
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);
138 
139  int lxvst_discover_from_path (std::string path, bool cache_only = false);
140  int lxvst_discover (std::string path, bool cache_only = false);
141 
142  int ladspa_discover (std::string path);
143 
144  std::string get_ladspa_category (uint32_t id);
145  std::vector<uint32_t> ladspa_plugin_whitelist;
146 
147  static PluginManager* _instance; // singleton
148  PluginManager ();
149 };
150 
151 } /* namespace ARDOUR */
152 
153 #endif /* __ardour_plugin_manager_h__ */
154 
ARDOUR::PluginInfoList * _au_plugin_info
std::set< PluginStatus > PluginStatusList
PluginStatus(ARDOUR::PluginType t, std::string id, PluginStatusType s=Normal)
PluginStatusList statuses
ARDOUR::PluginInfoList * _windows_vst_plugin_info
std::map< uint32_t, std::string > rdf_type
ARDOUR::PluginInfoList * _lv2_plugin_info
ARDOUR::PluginInfoList _empty_plugin_info
const std::string get_default_windows_vst_path() const
LIBARDOUR_API uint64_t PluginManager
Definition: plugin.h:85
PBD::Signal0< void > PluginListChanged
static PluginManager * _instance
std::string windows_vst_path
Definition: amp.h:29
bool operator==(const PluginStatus &other) const
static std::string scanner_bin_path
#define LIBARDOUR_API
std::vector< uint32_t > ladspa_plugin_whitelist
ARDOUR::PluginInfoList * _ladspa_plugin_info
ARDOUR::PluginInfoList * _lxvst_plugin_info
bool operator<(const PluginStatus &other) const
std::list< PluginInfoPtr > PluginInfoList
Definition: plugin.h:90
const std::string get_default_lxvst_path() const