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.
21 #include "ardour/mute_master.h"
22 #include "ardour/rc_configuration.h"
26 using namespace ARDOUR;
28 MuteMaster::MuteMaster (Session& s, const std::string& name)
29 : AutomationControl (s, Evoral::Parameter (MuteAutomation), boost::shared_ptr<AutomationList>(), name)
30 , _mute_point (MutePoint (0))
32 // default range for parameter is fine
34 _automation = new AutomationList (MuteAutomation);
35 set_list (boost::shared_ptr<AutomationList>(_automation));
39 MuteMaster::clear_mute ()
41 if (_mute_point != MutePoint (0)) {
42 _mute_point = MutePoint (0);
43 MutePointChanged (); // EMIT SIGNAL
48 MuteMaster::mute_at (MutePoint mp)
50 if ((_mute_point & mp) != mp) {
51 _mute_point = MutePoint (_mute_point | mp);
52 MutePointChanged (); // EMIT SIGNAL
57 MuteMaster::unmute_at (MutePoint mp)
59 if ((_mute_point & mp) == mp) {
60 _mute_point = MutePoint (_mute_point & ~mp);
61 MutePointChanged (); // EMIT SIGNAL
66 MuteMaster::mute (bool yn)
68 /* convenience wrapper around AutomationControl method */
78 MuteMaster::mute_gain_at (MutePoint mp) const
80 if (_mute_point & mp) {
81 return Config->get_solo_mute_gain ();
88 MuteMaster::set_value (float f)
90 mute_at ((MutePoint) ((int) rint (f)));
94 MuteMaster::get_value () const
96 return (float) _mute_point;
100 MuteMaster::set_state (const XMLNode& node)
106 MuteMaster::get_state()
108 return *(new XMLNode (X_("MuteMaster")));