Returns (i.e. sidechains).
[ardour.git] / libs / ardour / control_outputs.cc
1 /*
2     Copyright (C) 2006 Paul Davis 
3     
4     This program is free software; you can redistribute it and/or modify it
5     under the terms of the GNU General Public License as published by the Free
6     Software Foundation; either version 2 of the License, or (at your option)
7     any later version.
8     
9     This program is distributed in the hope that it will be useful, but WITHOUT
10     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12     for more details.
13     
14     You should have received a copy of the GNU General Public License along
15     with this program; if not, write to the Free Software Foundation, Inc.,
16     675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19 #include <cmath>
20 #include <algorithm>
21 #include "ardour/control_outputs.h"
22 #include "ardour/audio_buffer.h"
23 #include "ardour/buffer_set.h"
24 #include "ardour/configuration.h"
25 #include "ardour/io.h"
26 #include "ardour/session.h"
27
28 using namespace std;
29
30 namespace ARDOUR {
31
32 ControlOutputs::ControlOutputs(Session& s, IO* io)
33         : IOProcessor(s, io, "Control Outs")
34         , _deliver(true)
35 {
36 }
37
38 bool
39 ControlOutputs::can_support_io_configuration (const ChanCount& in, ChanCount& out) const
40 {
41         out = in;
42         return true;
43 }
44
45 bool
46 ControlOutputs::configure_io (ChanCount in, ChanCount out)
47 {
48         if (out != in) { // always 1:1
49                 return false;
50         }
51         
52         return Processor::configure_io (in, out);
53 }
54
55 void
56 ControlOutputs::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes)
57 {
58         if (_deliver) {
59                 _io->deliver_output (bufs, start_frame, end_frame, nframes);
60         } else {
61                 _io->silence (nframes);
62         }
63 }
64
65 XMLNode&
66 ControlOutputs::state (bool full_state)
67 {
68         return get_state();
69 }
70
71 XMLNode&
72 ControlOutputs::get_state()
73 {
74         XMLNode* node = new XMLNode(state_node_name);
75         node->add_property("type", "control-outputs");
76         return *node;
77 }
78
79 } // namespace ARDOUR