diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-17 20:41:31 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-17 20:41:31 +0000 |
commit | b9ff443085b0513d95c867cce81595b9509b2dff (patch) | |
tree | 63cecbc0b2215cb9dff5935c244e8009a97de1e2 /libs/surfaces/mackie/mackie_control_protocol.cc | |
parent | a382da49183c14cb5ab5e3d89c238e7d86de6382 (diff) |
MCP: various work on the button binding GUI
git-svn-id: svn://localhost/ardour2/branches/3.0@11997 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/surfaces/mackie/mackie_control_protocol.cc')
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 40ad239696..8698391646 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -57,6 +57,7 @@ #include "midi_byte_array.h" #include "mackie_control_exception.h" +#include "device_profile.h" #include "surface_port.h" #include "surface.h" #include "strip.h" @@ -108,7 +109,10 @@ MackieControlProtocol::MackieControlProtocol (Session& session) DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n"); DeviceInfo::reload_device_info (); + DeviceProfile::reload_device_profiles (); + set_device (Config->get_mackie_device_name()); + set_profile (Config->get_mackie_device_profile()); AudioEngine::instance()->PortConnectedOrDisconnected.connect ( audio_engine_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::port_connected_or_disconnected, this, _2, _4, _5), @@ -507,6 +511,23 @@ MackieControlProtocol::connect_session_signals() } void +MackieControlProtocol::set_profile (const string& profile_name) +{ + if (profile_name == "default") { + /* reset to default */ + _device_profile = DeviceProfile (profile_name); + } + + map<string,DeviceProfile>::iterator d = DeviceProfile::device_profiles.find (profile_name); + + if (d == DeviceProfile::device_profiles.end()) { + return; + } + + _device_profile = d->second; +} + +void MackieControlProtocol::set_device (const string& device_name) { map<string,DeviceInfo>::iterator d = DeviceInfo::device_info.find (device_name); @@ -1016,6 +1037,22 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Handling %1 for button %2\n", (bs == press ? "press" : "release"), button.id())); + /* check profile first */ + + string action = _device_profile.get_button_action (button.bid(), _modifier_state); + + if (!action.empty()) { + /* if there is a bound action for this button, and this is a press event, + carry out the action. If its a release event, do nothing since we + don't bind to them at all but don't want any other handling to + occur either. + */ + if (bs == press) { + access_action (action); + } + return; + } + /* lookup using the device-INDEPENDENT button ID */ ButtonMap::iterator b = button_map.find (button.bid()); |