From 78d5e6af289ff0e05a0058d078b79d3cc4d1c27d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 20 Nov 2019 09:37:14 -0700 Subject: [PATCH] add mixer actions for toggle disk & input monitoring; bind to d and i in mixer bindings --- gtk2_ardour/mixer.bindings | 3 ++- gtk2_ardour/mixer_ui.cc | 35 +++++++++++++++++++++++++++++++++++ gtk2_ardour/mixer_ui.h | 2 ++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/mixer.bindings b/gtk2_ardour/mixer.bindings index 436fa6687e..03fb9c3b7e 100644 --- a/gtk2_ardour/mixer.bindings +++ b/gtk2_ardour/mixer.bindings @@ -1,6 +1,7 @@ - + + diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 914a858a38..c5a2e947e9 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -49,6 +49,7 @@ #include "ardour/debug.h" #include "ardour/audio_track.h" #include "ardour/midi_track.h" +#include "ardour/monitor_control.h" #include "ardour/plugin_manager.h" #include "ardour/route_group.h" #include "ardour/selection.h" @@ -3403,6 +3404,8 @@ Mixer_UI::register_actions () ActionManager::register_toggle_action (group, X_("ToggleFoldbackStrip"), _("Mixer: Show Foldback Strip"), sigc::mem_fun (*this, &Mixer_UI::toggle_foldback_strip)); + ActionManager::register_toggle_action (group, X_("toggle-disk-monitor"), _("Toggle Disk Monitoring"), sigc::bind (sigc::mem_fun (*this, &Mixer_UI::toggle_monitor_action), MonitorDisk, false, false)); + ActionManager::register_toggle_action (group, X_("toggle-input-monitor"), _("Toggle Input Monitoring"), sigc::bind (sigc::mem_fun (*this, &Mixer_UI::toggle_monitor_action), MonitorInput, false, false)); } void @@ -3690,3 +3693,35 @@ Mixer_UI::screenshot (std::string const& filename) } return true; } + +void +Mixer_UI::toggle_monitor_action (MonitorChoice monitor_choice, bool group_override, bool all) +{ + MonitorChoice mc; + boost::shared_ptr rl; + + for (AxisViewSelection::iterator i = _selection.axes.begin(); i != _selection.axes.end(); ++i) { + boost::shared_ptr rt = boost::dynamic_pointer_cast ((*i)->stripable()); + + if (rt->monitoring_control()->monitoring_choice() & monitor_choice) { + mc = MonitorChoice (rt->monitoring_control()->monitoring_choice() & ~monitor_choice); + } else { + mc = MonitorChoice (rt->monitoring_control()->monitoring_choice() | monitor_choice); + } + + if (all) { + /* Primary-Tertiary-click applies change to all routes */ + rl = _session->get_routes (); + _session->set_controls (route_list_to_control_list (rl, &Stripable::monitoring_control), (double) mc, Controllable::NoGroup); + } else if (group_override) { + rl.reset (new RouteList); + rl->push_back (rt); + _session->set_controls (route_list_to_control_list (rl, &Stripable::monitoring_control), (double) mc, Controllable::InverseGroup); + } else { + rl.reset (new RouteList); + rl->push_back (rt); + _session->set_controls (route_list_to_control_list (rl, &Stripable::monitoring_control), (double) mc, Controllable::UseGroup); + } + + } +} diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 4eb7062fb2..7adc79d99e 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -158,6 +158,8 @@ public: bool screenshot (std::string const&); + void toggle_monitor_action (ARDOUR::MonitorChoice monitor_choice, bool group_override = false, bool all = false); + protected: void set_axis_targets_for_operation (); ARDOUR::AutomationControlSet selected_gaincontrols ();