From 4aa1c242ab1e1bf4fc3575c5d88a22824976a04f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 8 Apr 2016 16:51:34 -0400 Subject: add new files to source tree --- libs/ardour/monitor_control.cc | 80 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 libs/ardour/monitor_control.cc (limited to 'libs/ardour/monitor_control.cc') diff --git a/libs/ardour/monitor_control.cc b/libs/ardour/monitor_control.cc new file mode 100644 index 0000000000..c16de3b7c1 --- /dev/null +++ b/libs/ardour/monitor_control.cc @@ -0,0 +1,80 @@ +/* + Copyright (C) 2016 Paul Davis + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "ardour/monitor_control.h" + +#include "i18n.h" + +using namespace ARDOUR; +using namespace PBD; + +MonitorControl::MonitorControl (Session& session, std::string const & name, Monitorable& m) + : SlavableAutomationControl (session, MonitoringAutomation, ParameterDescriptor (MonitoringAutomation), + boost::shared_ptr(new AutomationList(Evoral::Parameter(MonitoringAutomation))), + name) + + , _monitorable (m) + , _monitoring (MonitorAuto) +{ + _list->set_interpolation(Evoral::ControlList::Discrete); + /* monitoring changes must be synchronized by the process cycle */ + set_flags (Controllable::Flag (flags() | Controllable::RealTime)); +} + +void +MonitorControl::actually_set_value (double val, Controllable::GroupControlDisposition gcd) +{ + int v = (int) val; + switch (v) { + case MonitorAuto: + case MonitorInput: + case MonitorDisk: + case MonitorCue: + break; + default: + /* illegal value */ + return; + } + + _monitoring = MonitorChoice (v); + AutomationControl::actually_set_value (val, gcd); +} + +XMLNode& +MonitorControl::get_state () +{ + XMLNode& node (SlavableAutomationControl::get_state()); + node.add_property (X_("monitoring"), enum_2_string (_monitoring)); + return node; +} + +int +MonitorControl::set_state (XMLNode const & node, int version) +{ + SlavableAutomationControl::set_state (node, version); + + const XMLProperty* prop; + + if ((prop = node.property (X_("monitoring"))) != 0) { + _monitoring = MonitorChoice (string_2_enum (prop->value(), _monitoring)); + } else { + _monitoring = MonitorAuto; + } + + return 0; +} -- cgit v1.2.3