Remove per-track mono option, as it seems somewhat useless now that we have a mix...
[ardour.git] / libs / ardour / panner.cc
1 /*
2     Copyright (C) 2004-2011 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 */
19
20 #include "ardour/audio_buffer.h"
21 #include "ardour/buffer_set.h"
22 #include "ardour/panner.h"
23 #include "ardour/pannable.h"
24 #include "ardour/session.h"
25 #include "ardour/utils.h"
26
27 using namespace std;
28 using namespace ARDOUR;
29
30 Panner::Panner (boost::shared_ptr<Pannable> p)
31         : _pannable (p)
32 {
33 }
34
35 Panner::~Panner ()
36 {
37 }
38
39 void
40 Panner::set_bypassed (bool yn)
41 {
42         if (yn != _bypassed) {
43                 _bypassed = yn;
44                 StateChanged ();
45         }
46 }
47
48 int
49 Panner::set_state (const XMLNode& node, int version)
50 {
51         const XMLProperty* prop;
52         XMLNodeConstIterator iter;
53
54         if ((prop = node.property (X_("bypassed"))) != 0) {
55                 set_bypassed (string_is_affirmative (prop->value()));
56         }
57
58         return 0;
59 }
60
61 XMLNode&
62 Panner::get_state ()
63 {
64         XMLNode* node = new XMLNode (X_("Panner"));
65
66         node->add_property (X_("bypassed"), (bypassed() ? "yes" : "no"));
67
68         return *node;
69 }
70
71 void
72 Panner::distribute (BufferSet& ibufs, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes)
73 {
74         uint32_t which = 0;
75
76         for (BufferSet::audio_iterator src = ibufs.audio_begin(); src != ibufs.audio_end(); ++src, ++which) {
77                 distribute_one (*src, obufs, gain_coeff, nframes, which);
78         }
79 }
80
81 void
82 Panner::distribute_automated (BufferSet& ibufs, BufferSet& obufs,
83                               framepos_t start, framepos_t end, pframes_t nframes, pan_t** buffers)
84 {
85         uint32_t which = 0;
86
87         for (BufferSet::audio_iterator src = ibufs.audio_begin(); src != ibufs.audio_end(); ++src, ++which) {
88                 distribute_one_automated (*src, obufs, start, end, nframes, buffers, which);
89         }
90 }
91
92 void
93 Panner::set_automation_style (AutoStyle style)
94 {
95         _pannable->set_automation_style (style);
96 }
97
98 void
99 Panner::set_automation_state (AutoState state)
100 {
101         _pannable->set_automation_state (state);
102 }
103
104 AutoState
105 Panner::automation_state () const
106 {
107         return _pannable->automation_state();
108 }
109
110 AutoStyle
111 Panner::automation_style () const
112 {
113         return _pannable->automation_style ();
114 }
115
116 bool
117 Panner::touching () const
118 {
119         return _pannable->touching ();
120 }
121
122 set<Evoral::Parameter> 
123 Panner::what_can_be_automated() const
124 {
125         return _pannable->what_can_be_automated ();
126 }
127
128 string
129 Panner::describe_parameter (Evoral::Parameter p)
130 {
131         return _pannable->describe_parameter (p);
132 }
133
134 string 
135 Panner::value_as_string (boost::shared_ptr<AutomationControl> ac) const
136 {
137         return _pannable->value_as_string (ac);
138 }