13
0

add some comments

This commit is contained in:
Paul Davis 2017-01-21 18:20:04 +00:00
parent 50b25571bc
commit 7daf620a8d

View File

@ -341,6 +341,10 @@ GenericMidiControlProtocol::start_learning (Controllable* c)
Glib::Threads::Mutex::Lock lm2 (controllables_lock);
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Learn binding: Controlable number: %1\n", c));
/* drop any existing mappings for the same controllable for which
* learning has just started.
*/
MIDIControllables::iterator tmp;
for (MIDIControllables::iterator i = controllables.begin(); i != controllables.end(); ) {
tmp = i;
@ -352,6 +356,10 @@ GenericMidiControlProtocol::start_learning (Controllable* c)
i = tmp;
}
/* check pending controllables (those for which a learn is underway) to
* see if it is for the same one for which learning has just started.
*/
{
Glib::Threads::Mutex::Lock lm (pending_lock);
@ -386,6 +394,8 @@ GenericMidiControlProtocol::start_learning (Controllable* c)
own_mc = true;
}
/* stuff the new controllable into pending */
{
Glib::Threads::Mutex::Lock lm (pending_lock);
@ -419,6 +429,10 @@ GenericMidiControlProtocol::learning_stopped (MIDIControllable* mc)
i = tmp;
}
/* add the controllable for which learning stopped to our list of
* controllables
*/
controllables.push_back (mc);
}