Merge with trunk R2935.
[ardour.git] / libs / ardour / ardour / plugin_manager.h
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 #include <list>
24 #include <map>
25 #include <string>
26
27 #include <ardour/types.h>
28 #include <ardour/plugin.h>
29
30 #ifdef HAVE_SLV2
31 #include <slv2/slv2.h>
32 #endif
33
34 namespace ARDOUR {
35
36 class Plugin;
37
38 class PluginManager {
39   public:
40         PluginManager ();
41         ~PluginManager ();
42
43         ARDOUR::PluginInfoList &vst_plugin_info ()    { return _vst_plugin_info; }
44         ARDOUR::PluginInfoList &ladspa_plugin_info () { return _ladspa_plugin_info; }
45         ARDOUR::PluginInfoList &lv2_plugin_info ()    { return _lv2_plugin_info; }
46         ARDOUR::PluginInfoList &au_plugin_info ()     { return _au_plugin_info; }
47
48         void refresh ();
49
50         int add_ladspa_directory (std::string dirpath);
51         int add_vst_directory (std::string dirpath);
52
53         static PluginManager* the_manager() { return _manager; }
54
55   private:
56         ARDOUR::PluginInfoList _vst_plugin_info;
57         ARDOUR::PluginInfoList _ladspa_plugin_info;
58         ARDOUR::PluginInfoList _lv2_plugin_info;
59         ARDOUR::PluginInfoList _au_plugin_info;
60
61 #ifdef HAVE_SLV2
62         SLV2World _lv2_world;
63 #endif
64         
65         std::map<uint32_t, std::string> rdf_type;
66
67         std::string ladspa_path;
68         std::string vst_path;
69
70         void ladspa_refresh ();
71         void vst_refresh ();
72
73         void add_lrdf_data (const std::string &path);
74         void add_ladspa_presets ();
75         void add_vst_presets ();
76         void add_presets (std::string domain);
77
78         int au_discover ();
79         void au_refresh ();
80         
81         int lv2_discover ();
82         void lv2_refresh ();
83
84         int vst_discover_from_path (std::string path);
85         int vst_discover (std::string path);
86
87         int ladspa_discover_from_path (std::string path);
88         int ladspa_discover (std::string path);
89
90         std::string get_ladspa_category (uint32_t id);
91         std::vector<uint32_t> ladspa_plugin_whitelist;
92
93         static PluginManager* _manager; // singleton
94 };
95
96 } /* namespace ARDOUR */
97
98 #endif /* __ardour_plugin_manager_h__ */
99