missing initialization
[ardour.git] / libs / panners / stereobalance / panner_balance.h
1 /*
2     Copyright (C) 2004-2014 Paul Davis
3     adopted from 2in2out panner by Robin Gareus <robin@gareus.org>
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #ifndef __ardour_panner_balance_h__
22 #define __ardour_panner_balance_h__
23
24 #include <cmath>
25 #include <cassert>
26 #include <vector>
27 #include <string>
28 #include <iostream>
29
30 #include "pbd/stateful.h"
31 #include "pbd/controllable.h"
32 #include "pbd/cartesian.h"
33
34 #include "ardour/automation_control.h"
35 #include "ardour/automatable.h"
36 #include "ardour/panner.h"
37 #include "ardour/types.h"
38
39 namespace ARDOUR {
40
41 class Pannerbalance : public Panner
42 {
43         public:
44         Pannerbalance (boost::shared_ptr<Pannable>);
45         ~Pannerbalance ();
46
47         ChanCount in() const { return ChanCount (DataType::AUDIO, 2); }
48         ChanCount out() const { return ChanCount (DataType::AUDIO, 2); }
49
50         void set_position (double);
51         bool clamp_position (double&);
52         std::pair<double, double> position_range () const;
53         double position () const;
54
55         std::set<Evoral::Parameter> what_can_be_automated() const;
56
57         static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
58
59         std::string describe_parameter (Evoral::Parameter);
60         std::string value_as_string (boost::shared_ptr<const AutomationControl>) const;
61
62         XMLNode& get_state ();
63
64         void reset ();
65         void thaw ();
66
67         protected:
68         float pos[2];
69         float desired_pos[2];
70         float pos_interp[2];
71
72         void update ();
73
74         private:
75         void distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which);
76         void distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs,
77                         framepos_t start, framepos_t end, pframes_t nframes,
78                         pan_t** buffers, uint32_t which);
79 };
80
81 } // namespace
82
83 #endif /* __ardour_panner_balance_h__ */