13
0

adds support for MCP device-specific button to function remapping

Adding this function so that different devices can remap their buttons
to functions based on device profile.
This commit is contained in:
Caleb Potter 2022-03-04 14:04:51 -06:00 committed by Paul Davis
parent 7633005a22
commit fc961f1622
2 changed files with 19 additions and 0 deletions

View File

@ -834,6 +834,8 @@ MackieControlProtocol::set_device (const string& device_name, bool force)
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connection, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::connection_handler, this, _1, _2, _3, _4, _5), this);
}
build_button_map();
if (create_surfaces ()) {
return -1;
}
@ -1503,6 +1505,12 @@ MackieControlProtocol::build_button_map ()
#define DEFINE_BUTTON_HANDLER(b,p,r) button_map.insert (pair<Button::ID,ButtonHandlers> ((b), ButtonHandlers ((p),(r))));
if(!button_map.empty()) {
button_map.clear();
}
build_device_specific_button_map();
DEFINE_BUTTON_HANDLER (Button::Track, &MackieControlProtocol::track_press, &MackieControlProtocol::track_release);
DEFINE_BUTTON_HANDLER (Button::Send, &MackieControlProtocol::send_press, &MackieControlProtocol::send_release);
DEFINE_BUTTON_HANDLER (Button::Pan, &MackieControlProtocol::pan_press, &MackieControlProtocol::pan_release);
@ -1570,6 +1578,16 @@ MackieControlProtocol::build_button_map ()
DEFINE_BUTTON_HANDLER (Button::MasterFaderTouch, &MackieControlProtocol::master_fader_touch_press, &MackieControlProtocol::master_fader_touch_release);
}
void
MackieControlProtocol::build_device_specific_button_map()
{
/* this maps our device-dependent button codes to the methods that handle them.
*/
#define DEFINE_BUTTON_HANDLER(b,p,r) button_map.insert (pair<Button::ID,ButtonHandlers> ((b), ButtonHandlers ((p),(r))));
}
void
MackieControlProtocol::handle_button_event (Surface& surface, Button& button, ButtonState bs)
{

View File

@ -353,6 +353,7 @@ class MackieControlProtocol
void clear_surfaces ();
void force_special_stripable_to_strip (boost::shared_ptr<ARDOUR::Stripable> r, uint32_t surface, uint32_t strip_number);
void build_button_map ();
void build_device_specific_button_map ();
void stripable_selection_changed ();
int ipmidi_restart ();
void initialize ();