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.
20 #ifndef __ardour_insert_h__
21 #define __ardour_insert_h__
27 #include <sigc++/signal.h>
28 #include <ardour/ardour.h>
29 #include <ardour/redirect.h>
30 #include <ardour/types.h>
45 class Insert
: public Redirect
48 Insert(Session
& s
, std::string name
, Placement p
);
49 Insert(Session
& s
, std::string name
, Placement p
, int imin
, int imax
, int omin
, int omax
);
53 virtual void run (vector
<Sample
*>& bufs
, uint32_t nbufs
, nframes_t nframes
) = 0;
54 virtual void activate () {}
55 virtual void deactivate () {}
56 virtual void flush () {}
58 virtual int32_t can_do (int32_t in
, int32_t& out
) = 0;
59 virtual int32_t configure_io (int32_t magic
, int32_t in
, int32_t out
) = 0;
62 class PortInsert
: public Insert
65 PortInsert (Session
&, Placement
);
66 PortInsert (Session
&, const XMLNode
&);
67 PortInsert (const PortInsert
&);
70 XMLNode
& state(bool full
);
71 XMLNode
& get_state(void);
72 int set_state(const XMLNode
&);
75 void run (vector
<Sample
*>& bufs
, uint32_t nbufs
, nframes_t nframes
);
79 uint32_t output_streams() const;
80 uint32_t input_streams() const;
82 int32_t can_do (int32_t, int32_t& out
);
83 int32_t configure_io (int32_t magic
, int32_t in
, int32_t out
);
84 uint32_t bit_slot() const { return bitslot
; }
86 void start_latency_detection ();
87 void stop_latency_detection ();
89 MTDM
* mtdm () const { return _mtdm
; }
90 void set_measured_latency (nframes_t
);
96 nframes_t _latency_flush_frames
;
97 nframes_t _measured_latency
;
100 class PluginInsert
: public Insert
103 PluginInsert (Session
&, boost::shared_ptr
<Plugin
>, Placement
);
104 PluginInsert (Session
&, const XMLNode
&);
105 PluginInsert (const PluginInsert
&);
108 static const string port_automation_node_name
;
110 XMLNode
& state(bool);
111 XMLNode
& get_state(void);
112 int set_state(const XMLNode
&);
114 void run (vector
<Sample
*>& bufs
, uint32_t nbufs
, nframes_t nframes
);
115 void silence (nframes_t nframes
);
120 int set_block_size (nframes_t nframes
);
122 uint32_t output_streams() const;
123 uint32_t input_streams() const;
124 uint32_t natural_output_streams() const;
125 uint32_t natural_input_streams() const;
127 int set_count (uint32_t num
);
128 uint32_t get_count () const { return _plugins
.size(); }
130 int32_t can_do (int32_t, int32_t& out
);
131 int32_t configure_io (int32_t magic
, int32_t in
, int32_t out
);
133 bool is_generator() const;
135 void set_parameter (uint32_t port
, float val
);
137 AutoState
get_port_automation_state (uint32_t port
);
138 void set_port_automation_state (uint32_t port
, AutoState
);
139 void protect_automation ();
141 float default_parameter_value (uint32_t which
);
143 boost::shared_ptr
<Plugin
> plugin(uint32_t num
=0) const {
144 if (num
< _plugins
.size()) {
145 return _plugins
[num
];
147 return _plugins
[0]; // we always have one
153 string
describe_parameter (uint32_t);
157 void transport_stopped (nframes_t now
);
158 void automation_snapshot (nframes_t now
, bool force
);
162 void parameter_changed (uint32_t, float);
164 vector
<boost::shared_ptr
<Plugin
> > _plugins
;
165 void automation_run (vector
<Sample
*>& bufs
, uint32_t nbufs
, nframes_t nframes
);
166 void connect_and_run (vector
<Sample
*>& bufs
, uint32_t nbufs
, nframes_t nframes
, nframes_t offset
, bool with_auto
, nframes_t now
= 0);
169 void set_automatable ();
170 void auto_state_changed (uint32_t which
);
171 void automation_list_creation_callback (uint32_t, AutomationList
&);
173 boost::shared_ptr
<Plugin
> plugin_factory (boost::shared_ptr
<Plugin
>);
176 } // namespace ARDOUR
178 #endif /* __ardour_insert_h__ */