summaryrefslogtreecommitdiff
path: root/libs/ardour/monitor_control.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-04-08 16:51:34 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-05-31 15:30:40 -0400
commit4aa1c242ab1e1bf4fc3575c5d88a22824976a04f (patch)
treef71d4c56255a9c72bfd582668d03caed1d2c731c /libs/ardour/monitor_control.cc
parent653ae4acd639fef149314fe6f8c7a0d862afae40 (diff)
add new files to source tree
Diffstat (limited to 'libs/ardour/monitor_control.cc')
-rw-r--r--libs/ardour/monitor_control.cc80
1 files changed, 80 insertions, 0 deletions
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<AutomationList>(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;
+}