remove Session::AudioMidiSetupRequired signal (no longer necessary)
[ardour.git] / libs / ardour / panner.cc
1 /*
2  * Copyright (C) 2005-2006 Jesse Chappell <jesse@essej.net>
3  * Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2006-2012 David Robillard <d@drobilla.net>
5  * Copyright (C) 2008-2012 Carl Hetherington <carl@carlh.net>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #include "ardour/buffer_set.h"
23 #include "ardour/debug.h"
24 #include "ardour/panner.h"
25 #include "ardour/pannable.h"
26
27 #include "pbd/i18n.h"
28
29 using namespace std;
30 using namespace ARDOUR;
31
32 Panner::Panner (boost::shared_ptr<Pannable> p)
33         : _frozen (0)
34 {
35         // boost_debug_shared_ptr_mark_interesting (this, "panner");
36         _pannable = p;
37 }
38
39 Panner::~Panner ()
40 {
41         DEBUG_TRACE(PBD::DEBUG::Destruction, string_compose ("panner @ %1 destructor, pannable is %2 @ %3\n", this, _pannable, &_pannable));
42 }
43
44 XMLNode&
45 Panner::get_state ()
46 {
47         return *(new XMLNode (X_("Panner")));
48 }
49
50 void
51 Panner::distribute (BufferSet& ibufs, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes)
52 {
53         uint32_t which = 0;
54
55         for (BufferSet::audio_iterator src = ibufs.audio_begin(); src != ibufs.audio_end(); ++src, ++which) {
56                 distribute_one (*src, obufs, gain_coeff, nframes, which);
57         }
58 }
59
60 void
61 Panner::distribute_automated (BufferSet& ibufs, BufferSet& obufs,
62                               samplepos_t start, samplepos_t end, pframes_t nframes, pan_t** buffers)
63 {
64         uint32_t which = 0;
65
66         for (BufferSet::audio_iterator src = ibufs.audio_begin(); src != ibufs.audio_end(); ++src, ++which) {
67                 distribute_one_automated (*src, obufs, start, end, nframes, buffers, which);
68         }
69 }
70
71 void
72 Panner::set_automation_state (AutoState state)
73 {
74         _pannable->set_automation_state (state);
75 }
76
77 AutoState
78 Panner::automation_state () const
79 {
80         return _pannable->automation_state();
81 }
82
83 bool
84 Panner::touching () const
85 {
86         return _pannable->touching ();
87 }
88
89 set<Evoral::Parameter>
90 Panner::what_can_be_automated() const
91 {
92         return _pannable->what_can_be_automated ();
93 }
94
95 string
96 Panner::describe_parameter (Evoral::Parameter p)
97 {
98         return _pannable->describe_parameter (p);
99 }
100
101 string
102 Panner::value_as_string (boost::shared_ptr<const AutomationControl> ac) const
103 {
104         return _pannable->value_as_string (ac);
105 }
106
107 int
108 Panner::set_state (XMLNode const &, int)
109 {
110         return 0;
111 }
112
113 void
114 Panner::freeze ()
115 {
116         _frozen++;
117 }
118
119 void
120 Panner::thaw ()
121 {
122         if (_frozen > 0.0) {
123                 _frozen--;
124         }
125 }