2 Copyright (C) 2016 Paul Davis
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)
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
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.
19 #include "ardour/debug.h"
20 #include "ardour/mute_master.h"
21 #include "ardour/session.h"
22 #include "ardour/solo_isolate_control.h"
26 using namespace ARDOUR;
30 SoloSafeControl::SoloSafeControl (Session& session, std::string const & name)
31 : SlavableAutomationControl (session, SoloSafeAutomation, ParameterDescriptor (SoloSafeAutomation),
32 boost::shared_ptr<AutomationList>(new AutomationList(Evoral::Parameter(SoloSafeAutomation))),
36 _list->set_interpolation(Evoral::ControlList::Discrete);
40 SoloSafeControl::actually_set_value (double val, PBD::Controllable::GroupControlDisposition gcd)
42 _solo_safe = (val ? true : false);
44 /* this sets the Evoral::Control::_user_value for us, which will
45 be retrieved by AutomationControl::get_value (), and emits Changed
48 AutomationControl::actually_set_value (val, gcd);
52 SoloSafeControl::get_value () const
55 Glib::Threads::RWLock::ReaderLock lm (master_lock);
56 return get_masters_value_locked () ? 1.0 : 0.0;
59 if (_list && boost::dynamic_pointer_cast<AutomationList>(_list)->automation_playback()) {
60 // Playing back automation, get the value from the list
61 return AutomationControl::get_value();
64 return _solo_safe ? 1.0 : 0.0;
68 SoloSafeControl::set_state (XMLNode const & node, int version)
70 if (SlavableAutomationControl::set_state(node, version)) {
74 node.get_property ("solo-safe", _solo_safe);
79 SoloSafeControl::get_state ()
81 XMLNode& node (SlavableAutomationControl::get_state());
82 node.set_property (X_("solo-safe"), _solo_safe);