remove reference to plugin_state.h in VST code
[ardour.git] / libs / ardour / ardour / vst_plugin.h
1 /*
2     Copyright (C) 2004 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     $Id$
19 */
20
21 #ifndef __ardour_vst_plugin_h__
22 #define __ardour_vst_plugin_h__
23
24 #include <list>
25 #include <map>
26 #include <set>
27 #include <vector>
28 #include <string>
29 #include <dlfcn.h>
30
31 #include <sigc++/signal.h>
32 #include <pbd/stateful.h> 
33 #include <jack/types.h>
34 #include <ardour/plugin.h>
35
36 using std::string;
37 using std::vector;
38 using std::list;
39 using std::map;
40
41 struct _FSTHandle;
42 struct _FST;
43 typedef struct _FSTHandle FSTHandle;
44 typedef struct _FST FST;
45 class AEffect;
46
47 namespace ARDOUR {
48 class AudioEngine;
49 class Session;
50
51 class VSTPlugin : public ARDOUR::Plugin
52 {
53   public:
54         VSTPlugin (ARDOUR::AudioEngine&, ARDOUR::Session&, FSTHandle* handle);
55         VSTPlugin (const VSTPlugin &);
56         ~VSTPlugin ();
57
58         /* Plugin interface */
59         
60         uint32_t unique_id() const;
61         const char * label() const;
62         const char * name() const;
63         const char * maker() const;
64         uint32_t parameter_count() const;
65         float default_value (uint32_t port);
66         nframes_t latency() const;
67         void set_parameter (uint32_t port, float val);
68         float get_parameter (uint32_t port) const;
69         int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const;
70         std::set<uint32_t> automatable() const;
71         uint32_t nth_parameter (uint32_t port, bool& ok) const;
72         void activate ();
73         void deactivate ();
74         void set_block_size (nframes_t nframes);
75         int connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset);
76         string describe_parameter (uint32_t);
77         string state_node_name() const { return "vst"; }
78         void print_parameter (uint32_t, char*, uint32_t len) const;
79
80         bool parameter_is_audio(uint32_t i) const { return false; }
81         bool parameter_is_control(uint32_t i) const { return true; }
82         bool parameter_is_input(uint32_t i) const { return true; }
83         bool parameter_is_output(uint32_t i) const { return false; }
84
85         bool load_preset (const string preset_label );
86         bool save_preset(string name);
87
88         bool has_editor () const;
89
90         XMLNode& get_state();
91         int set_state(const XMLNode& node);
92
93         AEffect* plugin() const { return _plugin; }
94         FST* fst() const { return _fst; }
95
96
97   private:
98         FSTHandle* handle;
99         FST*       _fst;
100         AEffect*   _plugin;
101         bool        been_resumed;
102 };
103
104 class VSTPluginInfo : public PluginInfo
105 {
106   public:
107         VSTPluginInfo () {}
108         ~VSTPluginInfo () {}
109         
110         PluginPtr load (Session& session);
111 };
112
113 typedef boost::shared_ptr<VSTPluginInfo> VSTPluginInfoPtr;
114
115 } // namespace ARDOUR
116
117 #endif /* __ardour_vst_plugin_h__ */