From 8b212bfa1294aa0e751690de355b05d4eaa82759 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 6 Mar 2019 19:46:51 -0700 Subject: [PATCH] a more nuanced version of the "do-not-automatically-disconnect-selection-follows-input --- libs/ardour/session_midi.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 4d1653b7f7..18ee55408c 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -756,6 +756,18 @@ Session::rewire_selected_midi (boost::shared_ptr new_midi_target) } for (vector::const_iterator p = msp.begin(); p != msp.end(); ++p) { + PortManager::MidiPortInformation mpi (AudioEngine::instance()->midi_port_information (*p)); + + /* if a port is marked for control data, do not + * disconnect it from everything since it may also be + * used via a control surface or some other + * functionality. + */ + + if (!(mpi.properties & MidiPortControl)) { + /* disconnect the port from everything */ + AudioEngine::instance()->disconnect (*p); + } /* connect it to the new target */ new_midi_target->input()->connect (new_midi_target->input()->nth(0), (*p), this); }