2 * Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2016 Tim Mayberry <mojofunk@gmail.com>
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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "ardour/debug.h"
21 #include "ardour/mute_master.h"
22 #include "ardour/session.h"
23 #include "ardour/solo_isolate_control.h"
27 using namespace ARDOUR;
31 SoloSafeControl::SoloSafeControl (Session& session, std::string const & name)
32 : SlavableAutomationControl (session, SoloSafeAutomation, ParameterDescriptor (SoloSafeAutomation),
33 boost::shared_ptr<AutomationList>(new AutomationList(Evoral::Parameter(SoloSafeAutomation))),
37 _list->set_interpolation(Evoral::ControlList::Discrete);
41 SoloSafeControl::actually_set_value (double val, PBD::Controllable::GroupControlDisposition gcd)
43 _solo_safe = (val ? true : false);
45 /* this sets the Evoral::Control::_user_value for us, which will
46 be retrieved by AutomationControl::get_value (), and emits Changed
49 AutomationControl::actually_set_value (val, gcd);
53 SoloSafeControl::get_value () const
56 Glib::Threads::RWLock::ReaderLock lm (master_lock);
57 return get_masters_value_locked () ? 1.0 : 0.0;
60 if (_list && boost::dynamic_pointer_cast<AutomationList>(_list)->automation_playback()) {
61 // Playing back automation, get the value from the list
62 return AutomationControl::get_value();
65 return _solo_safe ? 1.0 : 0.0;
69 SoloSafeControl::set_state (XMLNode const & node, int version)
71 if (SlavableAutomationControl::set_state(node, version)) {
75 node.get_property ("solo-safe", _solo_safe);
80 SoloSafeControl::get_state ()
82 XMLNode& node (SlavableAutomationControl::get_state());
83 node.set_property (X_("solo-safe"), _solo_safe);