6f5999efb44c8b704a440061900400fe15d78b12
[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 <string>
24
25 #include "pbd/signals.h"
26 #include "pbd/stateful.h"
27
28 #include "evoral/Parameter.hpp"
29
30 #include "ardour/session_handle.h"
31 #include "ardour/types.h"
32
33 namespace ARDOUR {
34
35 class Session;
36
37 class LIBARDOUR_API MuteMaster : public SessionHandleRef, public PBD::Stateful
38 {
39   public:
40         /** deliveries to mute when the channel is "muted" */
41         enum MutePoint {
42                 PreFader  = 0x1, ///< mute all pre-fader sends
43                 PostFader = 0x2, ///< mute all post-fader sends
44                 Listen    = 0x4, ///< mute listen out
45                 Main      = 0x8  ///< mute main out
46         };
47
48         static const MutePoint AllPoints;
49
50         MuteMaster (Session& s, const std::string& name);
51         ~MuteMaster() {}
52
53         bool muted_by_self () const { return _muted_by_self && (_mute_point != MutePoint (0)); }
54         bool muted_by_self_at (MutePoint mp) const { return _muted_by_self && (_mute_point & mp); }
55         bool muted_by_others_soloing_at (MutePoint mp) const;
56         bool muted_by_masters () const { return _muted_by_masters && (_mute_point != MutePoint (0)); }
57         bool muted_by_masters_at (MutePoint mp) const { return _muted_by_masters && (_mute_point & mp); }
58
59         gain_t mute_gain_at (MutePoint) const;
60
61         void set_muted_by_self (bool yn) { _muted_by_self = yn; }
62
63         void mute_at (MutePoint);
64         void unmute_at (MutePoint);
65
66         void set_mute_points (const std::string& mute_point);
67         void set_mute_points (MutePoint);
68         MutePoint mute_points() const { return _mute_point; }
69
70         void set_soloed_by_self (bool yn) { _soloed_by_self = yn; }
71         void set_soloed_by_others (bool yn) { _soloed_by_others = yn; }
72         void set_solo_ignore (bool yn) { _solo_ignore = yn; }
73
74         void set_muted_by_masters (bool);
75
76         PBD::Signal0<void> MutePointChanged;
77
78         XMLNode& get_state();
79         int set_state(const XMLNode&, int version);
80         static const std::string xml_node_name;
81
82   private:
83         MutePoint _mute_point;
84         bool      _muted_by_self;
85         bool      _soloed_by_self;
86         bool      _soloed_by_others;
87         bool      _solo_ignore;
88         bool      _muted_by_masters;
89 };
90
91 } // namespace ARDOUR
92
93 #endif /*__ardour_mute_master_h__ */