From 02c498a8fa1c2e47988a256321bdcf5e9e869de1 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 16 Apr 2012 13:06:39 +0000 Subject: [PATCH] MCP: make v-pot press work; work ongoing on general keybindings git-svn-id: svn://localhost/ardour2/branches/3.0@11985 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/surfaces/mackie/device_info.h | 12 +++++ libs/surfaces/mackie/gui.cc | 2 +- .../mackie/mackie_control_protocol.cc | 42 --------------- .../surfaces/mackie/mackie_control_protocol.h | 3 -- libs/surfaces/mackie/mcp_buttons.cc | 11 ++++ libs/surfaces/mackie/strip.cc | 53 +++++++++++++++++-- 6 files changed, 72 insertions(+), 51 deletions(-) diff --git a/libs/surfaces/mackie/device_info.h b/libs/surfaces/mackie/device_info.h index e7f0bc7166..287bed5c0e 100644 --- a/libs/surfaces/mackie/device_info.h +++ b/libs/surfaces/mackie/device_info.h @@ -104,6 +104,18 @@ class DeviceProfile const std::string& get_f_action (uint32_t fn, int modifier_state); void set_f_action (uint32_t fn, int modifier_state, const std::string&); + + private: + struct KeyActions { + std::string plain; + std::string control; + std::string shift; + std::string option; + std::string cmdalt; + std::string shiftcontrol; + }; + + typedef std::map KeyActionMap; }; } diff --git a/libs/surfaces/mackie/gui.cc b/libs/surfaces/mackie/gui.cc index 6ca76d4c0e..1086e44bfb 100644 --- a/libs/surfaces/mackie/gui.cc +++ b/libs/surfaces/mackie/gui.cc @@ -240,7 +240,7 @@ MackieControlProtocolGUI::rebuild_function_key_editor () row = *(function_key_model->append()); row[function_key_columns.name] = string_compose ("F%1", n+1); row[function_key_columns.number] = n; - row[function_key_columns.plain] = _cp.f_action (n, 0); + row[function_key_columns.plain] = ""; // _cp.f_action (n, 0); row[function_key_columns.control] = "c"; row[function_key_columns.option] = "o"; row[function_key_columns.shift] = "s"; diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index c0ad5fde1f..c681d5ac89 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -615,12 +615,6 @@ MackieControlProtocol::get_state() os << _current_initial_bank; node->add_property (X_("bank"), os.str()); - for (uint32_t n = 0; n < 16; ++n) { - ostringstream s; - s << string_compose ("f%1-action", n+1); - node->add_property (s.str().c_str(), f_action (n)); - } - return *node; } @@ -642,23 +636,6 @@ MackieControlProtocol::set_state (const XMLNode & node, int /*version*/) } } - _f_actions.clear (); - _f_actions.resize (16); - - for (uint32_t n = 0; n < 16; ++n) { - string action; - if ((prop = node.property (string_compose ("f%1-action", n+1))) != 0) { - action = prop->value(); - } - - if (action.empty()) { - /* default action if nothing is specified */ - action = string_compose ("Editor/goto-visual-state-%1", n+1); - } - - _f_actions[n] = action; - } - return retval; } @@ -1140,25 +1117,6 @@ MackieControlProtocol::clear_ports () port_sources.clear (); } -string -MackieControlProtocol::f_action (uint32_t fn, uint32_t /* modifier */) -{ - if (fn >= _f_actions.size()) { - return string(); - } - - return _f_actions[fn]; -} - -void -MackieControlProtocol::f_press (uint32_t fn) -{ - string action = f_action (0); - if (!action.empty()) { - access_action (action); - } -} - void MackieControlProtocol::set_view_mode (ViewMode m) { diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index cab0521a54..ea3e69d9a7 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -191,8 +191,6 @@ class MackieControlProtocol void remove_down_select_button (int surface, int strip); void select_range (); - std::string f_action (uint32_t fn, uint32_t modifier = 0); - protected: // shut down the surface void close(); @@ -279,7 +277,6 @@ class MackieControlProtocol int _current_selected_track; int _modifier_state; PortSources port_sources; - std::vector _f_actions; ButtonMap button_map; void create_surfaces (); diff --git a/libs/surfaces/mackie/mcp_buttons.cc b/libs/surfaces/mackie/mcp_buttons.cc index 5999220c52..4032785a3b 100644 --- a/libs/surfaces/mackie/mcp_buttons.cc +++ b/libs/surfaces/mackie/mcp_buttons.cc @@ -663,6 +663,17 @@ MackieControlProtocol::enter_release (Button &) { return off; } + +void +MackieControlProtocol::f_press (uint32_t fn) +{ +#if 0 + string action = f_action (0); + if (!action.empty()) { + access_action (action); + } +#endif +} LedState MackieControlProtocol::F1_press (Button &) { diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index a00a75dffd..e8a2415cfe 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -399,7 +399,19 @@ Strip::handle_button (Button& button, ButtonState bs) return; } - + + if (button.bid() == Button::VSelect) { + if (bs == press) { + /* swap controls on the vpot */ + boost::shared_ptr ac = button.control (true); + button.set_modified_control (button.control (false)); + button.set_normal_control (ac); + _surface->write (display (1, static_display_string ())); + } + + return; + } + if (button.bid() == Button::FaderTouch) { DEBUG_TRACE (DEBUG::MackieControl, string_compose ("fader touch, press ? %1\n", (bs == press))); @@ -663,11 +675,42 @@ Strip::gui_selection_changed (ARDOUR::RouteNotificationListPtr rl) string Strip::static_display_string () const { - if (_surface->mcp().flip_mode()) { - return "Fader"; - } else { - return "Pan"; + if (!_vpot) { + return string(); } + + boost::shared_ptr ac = _vpot->control (false); + + if (!ac) { + return string(); + } + + /* don't use canonical controllable names here because we're + * limited by space concerns + */ + + switch((AutomationType)ac->parameter().type()) { + case GainAutomation: + return "Fader"; + break; + case PanAzimuthAutomation: + return "Pan"; + break; + case PanWidthAutomation: + return "Width"; + break; + case PanElevationAutomation: + case PanFrontBackAutomation: + case PanLFEAutomation: + break; + case PluginAutomation: + return string_compose ("Param %d", ac->parameter().id()); + break; + default: + break; + } + + return "???"; } void