2 Copyright (C) 2000-2006 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_h__
21 #define __ardour_plugin_h__
23 #include <boost/shared_ptr.hpp>
24 #include <sigc++/signal.h>
25 #include <glibmm/ustring.h>
27 #include <pbd/statefuldestructible.h>
28 #include <pbd/controllable.h>
30 #include <jack/types.h>
31 #include <ardour/types.h>
32 #include <ardour/chan_count.h>
33 #include <ardour/cycles.h>
34 #include <ardour/latent.h>
35 #include <ardour/parameter.h>
36 #include <ardour/plugin_insert.h>
55 typedef boost::shared_ptr<Plugin> PluginPtr;
60 PluginInfo (const PluginInfo &o)
62 category (o.category),
66 n_outputs(o.n_outputs),
67 unique_id(o.unique_id),
69 virtual ~PluginInfo () { }
73 Glib::ustring creator;
77 ARDOUR::PluginType type;
79 std::string unique_id;
81 virtual PluginPtr load (Session& session) = 0;
84 friend class PluginManager;
88 typedef boost::shared_ptr<PluginInfo> PluginInfoPtr;
89 typedef std::list<PluginInfoPtr> PluginInfoList;
91 class Plugin : public PBD::StatefulDestructible, public Latent
94 Plugin (ARDOUR::AudioEngine&, ARDOUR::Session&);
95 Plugin (const Plugin&);
98 struct ParameterDescriptor {
100 /* essentially a union of LADSPA and VST info */
116 virtual std::string unique_id() const = 0;
117 virtual const char * label() const = 0;
118 virtual const char * name() const = 0;
119 virtual const char * maker() const = 0;
120 virtual uint32_t parameter_count () const = 0;
121 virtual float default_value (uint32_t port) = 0;
122 virtual float get_parameter(uint32_t which) const = 0;
124 virtual int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const = 0;
125 virtual uint32_t nth_parameter (uint32_t which, bool& ok) const = 0;
126 virtual void activate () = 0;
127 virtual void deactivate () = 0;
128 virtual void set_block_size (nframes_t nframes) = 0;
130 virtual int connect_and_run (BufferSet& bufs, uint32_t& in, uint32_t& out, nframes_t nframes, nframes_t offset) = 0;
132 virtual std::set<Parameter> automatable() const = 0;
133 virtual string describe_parameter (Parameter) = 0;
134 virtual string state_node_name() const = 0;
135 virtual void print_parameter (uint32_t, char*, uint32_t len) const = 0;
137 virtual bool parameter_is_audio(uint32_t) const = 0;
138 virtual bool parameter_is_control(uint32_t) const = 0;
139 virtual bool parameter_is_input(uint32_t) const = 0;
140 virtual bool parameter_is_output(uint32_t) const = 0;
142 virtual bool save_preset(string name) = 0;
143 virtual bool load_preset (const string preset_label);
144 virtual std::vector<std::string> get_presets();
146 virtual bool has_editor() const = 0;
148 PluginInfoPtr get_info() { return _info; }
149 void set_info (const PluginInfoPtr inf) { _info = inf; }
151 ARDOUR::AudioEngine& engine() const { return _engine; }
152 ARDOUR::Session& session() const { return _session; }
154 void set_cycles (uint32_t c) { _cycles = c; }
155 cycles_t cycles() const { return _cycles; }
158 friend class PluginInsert;
159 friend struct PluginInsert::PluginControl;
160 virtual void set_parameter (uint32_t which, float val) = 0;
162 ARDOUR::AudioEngine& _engine;
163 ARDOUR::Session& _session;
166 map<string,string> presets;
167 bool save_preset(string name, string domain /* vst, ladspa etc. */);
170 PluginPtr find_plugin(ARDOUR::Session&, string unique_id, ARDOUR::PluginType);
172 } // namespace ARDOUR
174 #endif /* __ardour_plugin_h__ */