From da6a6f1366b9e50af414ddde7ce8a95c8cbddc32 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 12 Jul 2018 21:42:57 +0200 Subject: [PATCH] CC121: watch Track monitoring state --- libs/surfaces/cc121/cc121.cc | 20 ++++++++++++++++++++ libs/surfaces/cc121/cc121.h | 1 + 2 files changed, 21 insertions(+) diff --git a/libs/surfaces/cc121/cc121.cc b/libs/surfaces/cc121/cc121.cc index afae36d524..76e175bb21 100644 --- a/libs/surfaces/cc121/cc121.cc +++ b/libs/surfaces/cc121/cc121.cc @@ -48,6 +48,7 @@ #include "ardour/filesystem_paths.h" #include "ardour/midi_port.h" #include "ardour/midiport_manager.h" +#include "ardour/monitor_control.h" #include "ardour/monitor_processor.h" #include "ardour/profile.h" #include "ardour/rc_configuration.h" @@ -1075,6 +1076,7 @@ CC121::set_current_stripable (boost::shared_ptr r) boost::shared_ptr t = boost::dynamic_pointer_cast (_current_stripable); if (t) { t->rec_enable_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&CC121::map_recenable, this), this); + t->monitoring_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&CC121::map_monitoring, this), this); } boost::shared_ptr control = _current_stripable->gain_control (); @@ -1181,6 +1183,23 @@ CC121::map_recenable () } else { get_button (Rec).set_led_state (_output_port, false); } + map_monitoring (); +} + +void +CC121::map_monitoring () +{ + boost::shared_ptr t = boost::dynamic_pointer_cast (_current_stripable); + if (t) { + MonitorState state = t->monitoring_control()->monitoring_state (); + if (state == MonitoringInput || state == MonitoringCue) { + get_button(InputMonitor).set_led_state (_output_port, true); + } else { + get_button(InputMonitor).set_led_state (_output_port, false); + } + } else { + get_button(InputMonitor).set_led_state (_output_port, false); + } } void @@ -1233,6 +1252,7 @@ CC121::map_stripable_state () map_recenable (); map_gain (); map_auto (); + map_monitoring (); if (_current_stripable == session->monitor_out()) { map_cut (); diff --git a/libs/surfaces/cc121/cc121.h b/libs/surfaces/cc121/cc121.h index 7c5bd39170..db3ef435ff 100644 --- a/libs/surfaces/cc121/cc121.h +++ b/libs/surfaces/cc121/cc121.h @@ -309,6 +309,7 @@ class CC121 : public ARDOUR::ControlProtocol, public AbstractUI { void map_gain (); void map_cut (); void map_auto (); + void map_monitoring (); /* operations (defined in operations.cc) */ -- 2.30.2