redesign VCA control over gain (and theoretically other scalar controls)
[ardour.git] / libs / ardour / ardour / phase_control.h
1 /*
2     Copyright (C) 2016 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify it
5     under the terms of the GNU General Public License as published by the Free
6     Software Foundation; either version 2 of the License, or (at your option)
7     any later version.
8
9     This program is distributed in the hope that it will be useful, but WITHOUT
10     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12     for more details.
13
14     You should have received a copy of the GNU General Public License along
15     with this program; if not, write to the Free Software Foundation, Inc.,
16     675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19 #ifndef __ardour_phase_control_h__
20 #define __ardour_phase_control_h__
21
22 #include <string>
23
24 #include <boost/shared_ptr.hpp>
25 #include <boost/dynamic_bitset.hpp>
26
27 #include "ardour/slavable_automation_control.h"
28 #include "ardour/libardour_visibility.h"
29
30 namespace ARDOUR {
31
32 class Session;
33
34 /* Note that PhaseControl is not Slavable. There's no particular reason for
35  * this, it could be changed at any time. But it seems useless.
36  */
37
38 class LIBARDOUR_API PhaseControl : public AutomationControl
39 {
40   public:
41         PhaseControl (Session& session, std::string const & name);
42
43         /* There are two approaches to designing/using a PhaseControl. One is
44          * to have one such control for every channel of the control's
45          * owner. The other is to have a single control which manages all
46          * channels. For now (Spring 2016) we're using the second design.
47          */
48
49         void set_phase_invert (uint32_t, bool yn);
50         void set_phase_invert (boost::dynamic_bitset<>);
51         bool inverted (uint32_t chn) const { return _phase_invert[chn]; }
52
53         bool none () const { return !_phase_invert.any(); }
54         bool any() const { return _phase_invert.any(); }
55         uint64_t count() const { return _phase_invert.count(); }
56         uint64_t size() const { return _phase_invert.size(); }
57         void resize (uint32_t);
58
59         int set_state (XMLNode const&, int);
60         XMLNode& get_state ();
61
62   protected:
63         void actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
64
65   private:
66         boost::dynamic_bitset<> _phase_invert;
67 };
68
69 } /* namespace */
70
71 #endif /* __libardour_phase_control_h__ */