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