From 496e6f2a4c5eaed7cf0e5cbed16ff63f53032462 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Tue, 22 Oct 2019 14:39:38 -0500 Subject: [PATCH] New implementation for single-fader mackie devices (reverts b96d8e) --- libs/surfaces/mackie/device_info.cc | 8 ++++-- .../mackie/mackie_control_protocol.cc | 26 +++++++++++++++---- libs/surfaces/mackie/mcp_buttons.cc | 10 +++++++ mcp/ruco.device | 3 ++- mcp/x-touch-one.device | 3 ++- 5 files changed, 41 insertions(+), 9 deletions(-) diff --git a/libs/surfaces/mackie/device_info.cc b/libs/surfaces/mackie/device_info.cc index c085aea812..820b2dc4f7 100644 --- a/libs/surfaces/mackie/device_info.cc +++ b/libs/surfaces/mackie/device_info.cc @@ -255,12 +255,16 @@ DeviceInfo::set_state (const XMLNode& node, int /* version */) if (!child->get_property ("value", _strip_cnt)) { _strip_cnt = 8; } - if (_strip_cnt==1) - _single_fader_follows_selection = true; } else { return -1; } + if ((child = node.child ("SingleFaderFollowsSelection")) != 0) { + child->get_property ("value", _single_fader_follows_selection); + } else { + _single_fader_follows_selection = false; + } + if ((child = node.child ("Extenders")) != 0) { if (!child->get_property ("value", _extenders)) { _extenders = 0; diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 7878a795bc..adf503f550 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -2407,6 +2407,27 @@ MackieControlProtocol::stripable_selection_changed () (*si)->update_strip_selection (); } + /* if we are following the Gui, find the selected strips and map them here */ + if (_device_info.single_fader_follows_selection()) { + + Sorted sorted = get_sorted_stripables(); + + Sorted::iterator r = sorted.begin(); + for (Surfaces::iterator si = surfaces.begin(); si != surfaces.end(); ++si) { + vector > stripables; + uint32_t added = 0; + + for (; r != sorted.end() && added < (*si)->n_strips (false); ++r, ++added) { + if ((*r)->is_selected()) { + stripables.push_back (*r); + } + } + + (*si)->map_stripables (stripables); + } + return; + } + boost::shared_ptr s = first_selected_stripable (); if (s) { check_fader_automation_state (); @@ -2437,11 +2458,6 @@ MackieControlProtocol::first_selected_stripable () const return s; } - /* if it's a single-fader surface, it should follow the selection */ - if (_device_info.single_fader_follows_selection()) { - return s; - } - /* stripable is not mapped. thus, the currently selected stripable is * not on the surfaces, and so from our perspective, there is * no currently selected stripable. diff --git a/libs/surfaces/mackie/mcp_buttons.cc b/libs/surfaces/mackie/mcp_buttons.cc index f9d6c1af8a..663ff6c017 100644 --- a/libs/surfaces/mackie/mcp_buttons.cc +++ b/libs/surfaces/mackie/mcp_buttons.cc @@ -270,6 +270,11 @@ MackieControlProtocol::cursor_down_release (Button&) LedState MackieControlProtocol::channel_left_press (Button &) { + if (_device_info.single_fader_follows_selection()) { + access_action ("Editor/select-prev-route"); + return on; + } + if (_subview_mode != None) { return none; } @@ -291,6 +296,11 @@ MackieControlProtocol::channel_left_release (Button &) LedState MackieControlProtocol::channel_right_press (Button &) { + if (_device_info.single_fader_follows_selection()) { + access_action ("Editor/select-next-route"); + return on; + } + if (_subview_mode != None) { return none; } diff --git a/mcp/ruco.device b/mcp/ruco.device index de2d642a15..d32bf3c633 100644 --- a/mcp/ruco.device +++ b/mcp/ruco.device @@ -2,7 +2,7 @@ - + @@ -12,4 +12,5 @@ + diff --git a/mcp/x-touch-one.device b/mcp/x-touch-one.device index 5131dd00d6..1fd7bc8ccb 100644 --- a/mcp/x-touch-one.device +++ b/mcp/x-touch-one.device @@ -2,7 +2,7 @@ - + @@ -12,4 +12,5 @@ +