ardour
panner.cc
Go to the documentation of this file.
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/buffer_set.h"
21 #include "ardour/debug.h"
22 #include "ardour/panner.h"
23 #include "ardour/pannable.h"
24 
25 #include "i18n.h"
26 
27 using namespace std;
28 using namespace ARDOUR;
29 
30 Panner::Panner (boost::shared_ptr<Pannable> p)
31  : _frozen (0)
32 {
33  // boost_debug_shared_ptr_mark_interesting (this, "panner");
34  _pannable = p;
35 }
36 
38 {
39  DEBUG_TRACE(PBD::DEBUG::Destruction, string_compose ("panner @ %1 destructor, pannable is %2 @ %3\n", this, _pannable, &_pannable));
40 }
41 
42 XMLNode&
44 {
45  return *(new XMLNode (X_("Panner")));
46 }
47 
48 void
49 Panner::distribute (BufferSet& ibufs, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes)
50 {
51  uint32_t which = 0;
52 
53  for (BufferSet::audio_iterator src = ibufs.audio_begin(); src != ibufs.audio_end(); ++src, ++which) {
54  distribute_one (*src, obufs, gain_coeff, nframes, which);
55  }
56 }
57 
58 void
60  framepos_t start, framepos_t end, pframes_t nframes, pan_t** buffers)
61 {
62  uint32_t which = 0;
63 
64  for (BufferSet::audio_iterator src = ibufs.audio_begin(); src != ibufs.audio_end(); ++src, ++which) {
65  distribute_one_automated (*src, obufs, start, end, nframes, buffers, which);
66  }
67 }
68 
69 void
71 {
72  _pannable->set_automation_style (style);
73 }
74 
75 void
77 {
78  _pannable->set_automation_state (state);
79 }
80 
83 {
84  return _pannable->automation_state();
85 }
86 
89 {
90  return _pannable->automation_style ();
91 }
92 
93 bool
95 {
96  return _pannable->touching ();
97 }
98 
99 set<Evoral::Parameter>
101 {
102  return _pannable->what_can_be_automated ();
103 }
104 
105 string
107 {
108  return _pannable->describe_parameter (p);
109 }
110 
111 string
113 {
114  return _pannable->value_as_string (ac);
115 }
116 
117 int
119 {
120  return 0;
121 }
122 
123 void
125 {
126  _frozen++;
127 }
128 
129 void
131 {
132  if (_frozen > 0.0) {
133  _frozen--;
134  }
135 }
virtual std::string value_as_string(boost::shared_ptr< AutomationControl >) const
Definition: panner.cc:112
AutoState automation_state() const
Definition: panner.cc:82
virtual void distribute(BufferSet &ibufs, BufferSet &obufs, gain_t gain_coeff, pframes_t nframes)
Definition: panner.cc:49
LIBARDOUR_API uint64_t Destruction
Definition: debug.cc:38
float pan_t
Definition: types.h:57
virtual void distribute_automated(BufferSet &ibufs, BufferSet &obufs, framepos_t start, framepos_t end, pframes_t nframes, pan_t **buffers)
Definition: panner.cc:59
int set_state(const XMLNode &, int version)
Definition: panner.cc:118
uint32_t pframes_t
Definition: types.h:61
Definition: Beats.hpp:239
float gain_t
Definition: types.h:58
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
Definition: region.cc:63
boost::shared_ptr< Pannable > _pannable
Definition: panner.h:178
AutoStyle
Definition: types.h:155
virtual void thaw()
Definition: panner.cc:130
AutoStyle automation_style() const
Definition: panner.cc:88
#define X_(Text)
Definition: i18n.h:13
XMLNode & get_state()
Definition: panner.cc:43
void set_automation_style(AutoStyle)
Definition: panner.cc:70
audio_iterator audio_begin()
Definition: buffer_set.h:173
Definition: amp.h:29
#define DEBUG_TRACE(bits, str)
Definition: debug.h:55
int64_t framepos_t
Definition: types.h:66
audio_iterator audio_end()
Definition: buffer_set.h:174
virtual std::string describe_parameter(Evoral::Parameter)
Definition: panner.cc:106
virtual void distribute_one(AudioBuffer &, BufferSet &obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which)=0
bool touching() const
Definition: panner.cc:94
virtual void distribute_one_automated(AudioBuffer &, BufferSet &obufs, framepos_t start, framepos_t end, pframes_t nframes, pan_t **buffers, uint32_t which)=0
virtual std::set< Evoral::Parameter > what_can_be_automated() const
Definition: panner.cc:100
Definition: xml++.h:95
virtual void freeze()
Definition: panner.cc:124
void set_automation_state(AutoState)
Definition: panner.cc:76
std::string string_compose(const std::string &fmt, const T1 &o1)
Definition: compose.h:208
int32_t _frozen
Definition: panner.h:185
AutoState
Definition: types.h:145