tentative commit of new panners subtree
[ardour.git] / libs / panners / 1in2out / panner_1in2out.h
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 #ifndef __ardour_panner_1in2out_h__
21 #define __ardour_panner_1in2out_h__
22
23 #include <cmath>
24 #include <cassert>
25 #include <vector>
26 #include <string>
27 #include <iostream>
28
29 #include "pbd/stateful.h"
30 #include "pbd/controllable.h"
31 #include "pbd/cartesian.h"
32
33 #include "ardour/types.h"
34 #include "ardour/automation_control.h"
35 #include "ardour/automatable.h"
36
37 namespace ARDOUR {
38
39 class PannerStereoBase : public class Panner
40 {
41   public:
42         PannerStereoBase (Panner&);
43         ~PannerStereoBase ();
44
45         void set_position (double);
46
47         ChanCount in() const { return ChanCount (DataType::AUDIO, 1); }
48         ChanCount out() const { return ChanCount (DataType::AUDIO, 2); }
49
50         /* this class just leaves the pan law itself to be defined
51            by the update(), do_distribute_automated()
52            methods. derived classes also need a factory method
53            and a type name. See EqualPowerStereoPanner as an example.
54         */
55
56         void do_distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes);
57
58   protected:
59         boost::shared_ptr<AutomationControl> _position;
60         float left;
61         float right;
62         float desired_left;
63         float desired_right;
64         float left_interp;
65         float right_interp;
66 };
67
68 }
69
70 #endif /* __ardour_panner_1in2out_h__ */