switch to using boost::signals2 instead of sigc++, at least for libardour. not finish...
[ardour.git] / libs / ardour / ardour / mute_master.h
1 /*
2     Copyright (C) 2009 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_mute_master_h__
21 #define __ardour_mute_master_h__
22
23 #include "evoral/Parameter.hpp"
24 #include "ardour/automation_control.h"
25 #include "ardour/automation_list.h"
26
27 namespace ARDOUR {
28
29 class Session;
30
31 class MuteMaster : public AutomationControl
32 {
33   public:
34         enum MutePoint {
35                 PreFader  = 0x1,
36                 PostFader = 0x2,
37                 Listen    = 0x4,
38                 Main      = 0x8
39         };
40
41         static const MutePoint AllPoints;
42
43         MuteMaster (Session& s, const std::string& name);
44         ~MuteMaster() {}
45
46         bool muted_pre_fader() const  { return _mute_point & PreFader; }
47         bool muted_post_fader() const { return _mute_point & PostFader; }
48         bool muted_listen() const     { return _mute_point & Listen; }
49         bool muted_main () const      { return _mute_point & Main; }
50
51         bool muted_at (MutePoint mp) const { return _mute_point & mp; }
52         bool muted() const { return _mute_point != MutePoint (0); }
53
54         gain_t mute_gain_at (MutePoint) const;
55
56         void clear_mute ();
57         void mute_at (MutePoint);
58         void unmute_at (MutePoint);
59
60         void mute (bool yn);
61
62         /* Controllable interface */
63
64         void set_value (float); /* note: float is used as a bitfield of MutePoints */
65         float get_value () const;
66
67         boost::signals2::signal<void()> MutePointChanged;
68
69         XMLNode& get_state();
70         int set_state(const XMLNode&, int version);
71
72   private:
73         AutomationList* _automation;
74         MutePoint _mute_point;
75 };
76
77 } // namespace ARDOUR
78
79 #endif /*__ardour_mute_master_h__ */