3 Copyright (C) 2009 Paul Davis
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.
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.
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.
22 #include "ardour/mute_master.h"
23 #include "ardour/rc_configuration.h"
27 using namespace ARDOUR;
29 MuteMaster::MuteMaster (Session& s, const std::string& name)
30 : AutomationControl (s, Evoral::Parameter (MuteAutomation), boost::shared_ptr<AutomationList>(), name)
31 , _mute_point (MutePoint (0))
33 // default range for parameter is fine
35 _automation = new AutomationList (MuteAutomation);
36 set_list (boost::shared_ptr<AutomationList>(_automation));
40 MuteMaster::clear_mute ()
42 if (_mute_point != MutePoint (0)) {
43 _mute_point = MutePoint (0);
44 MutePointChanged (); // EMIT SIGNAL
49 MuteMaster::mute_at (MutePoint mp)
51 if ((_mute_point & mp) != mp) {
52 _mute_point = MutePoint (_mute_point | mp);
53 MutePointChanged (); // EMIT SIGNAL
58 MuteMaster::unmute_at (MutePoint mp)
60 if ((_mute_point & mp) == mp) {
61 _mute_point = MutePoint (_mute_point & ~mp);
62 MutePointChanged (); // EMIT SIGNAL
67 MuteMaster::mute (bool yn)
69 /* convenience wrapper around AutomationControl method */
72 set_value ((float) 0xffff);
79 MuteMaster::mute_gain_at (MutePoint mp) const
81 if (_mute_point & mp) {
82 return Config->get_solo_mute_gain ();
89 MuteMaster::set_value (float f)
91 MutePoint old = _mute_point;
92 _mute_point = (MutePoint) (rint (f));
93 if (old != _mute_point) {
94 MutePointChanged (); // EMIT SIGNAL
99 MuteMaster::get_value () const
101 return (float) _mute_point;
105 MuteMaster::set_state (const XMLNode& node)
111 MuteMaster::get_state()
113 return *(new XMLNode (X_("MuteMaster")));