2 Copyright (C) 2000 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.
21 #ifndef __ardour_insert_h__
22 #define __ardour_insert_h__
28 #include <sigc++/signal.h>
29 #include <ardour/ardour.h>
30 #include <ardour/redirect.h>
31 #include <ardour/plugin_state.h>
32 #include <ardour/types.h>
46 class Insert : public Redirect
49 Insert(Session& s, std::string name, Placement p);
50 Insert(Session& s, std::string name, Placement p, int imin, int imax, int omin, int omax);
54 virtual void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) = 0;
56 virtual void activate () {}
57 virtual void deactivate () {}
59 virtual int32_t can_support_input_configuration (int32_t in) const = 0;
60 virtual int32_t configure_io (int32_t magic, int32_t in, int32_t out) = 0;
61 virtual int32_t compute_output_streams (int32_t cnt) const = 0;
64 class PortInsert : public Insert
67 PortInsert (Session&, Placement);
68 PortInsert (Session&, const XMLNode&);
69 PortInsert (const PortInsert&);
72 XMLNode& state(bool full);
73 XMLNode& get_state(void);
74 int set_state(const XMLNode&);
78 void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset);
82 ChanCount output_streams() const;
83 ChanCount input_streams() const;
85 int32_t can_support_input_configuration (int32_t) const;
86 int32_t configure_io (int32_t magic, int32_t in, int32_t out);
87 int32_t compute_output_streams (int32_t cnt) const;
89 uint32_t bit_slot() const { return bitslot; }
95 class PluginInsert : public Insert
98 PluginInsert (Session&, boost::shared_ptr<Plugin>, Placement);
99 PluginInsert (Session&, const XMLNode&);
100 PluginInsert (const PluginInsert&);
103 static const string port_automation_node_name;
105 XMLNode& state(bool);
106 XMLNode& get_state(void);
107 int set_state(const XMLNode&);
109 void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset);
110 void silence (nframes_t nframes, nframes_t offset);
115 void set_block_size (nframes_t nframes);
117 ChanCount output_streams() const;
118 ChanCount input_streams() const;
119 ChanCount natural_output_streams() const;
120 ChanCount natural_input_streams() const;
122 int set_count (uint32_t num);
123 uint32_t get_count () const { return _plugins.size(); }
125 int32_t can_support_input_configuration (int32_t) const;
126 int32_t configure_io (int32_t magic, int32_t in, int32_t out);
127 int32_t compute_output_streams (int32_t cnt) const;
129 bool is_generator() const;
131 void set_parameter (uint32_t port, float val);
133 AutoState get_port_automation_state (uint32_t port);
134 void set_port_automation_state (uint32_t port, AutoState);
135 void protect_automation ();
137 float default_parameter_value (uint32_t which);
139 boost::shared_ptr<Plugin> plugin(uint32_t num=0) const {
140 if (num < _plugins.size()) {
141 return _plugins[num];
143 return _plugins[0]; // we always have one
149 string describe_parameter (uint32_t);
153 void transport_stopped (nframes_t now);
154 void automation_snapshot (nframes_t now);
158 void parameter_changed (uint32_t, float);
160 vector<boost::shared_ptr<Plugin> > _plugins;
162 void automation_run (BufferSet& bufs, nframes_t nframes, nframes_t offset);
163 void connect_and_run (BufferSet& bufs, nframes_t nframes, nframes_t offset, bool with_auto, nframes_t now = 0);
166 void set_automatable ();
167 void auto_state_changed (uint32_t which);
168 void automation_list_creation_callback (uint32_t, AutomationList&);
170 boost::shared_ptr<Plugin> plugin_factory (boost::shared_ptr<Plugin>);
173 } // namespace ARDOUR
175 #endif /* __ardour_insert_h__ */