View Issue Details
|no change required
|0009183: MIDI Control Out periodically looses sync with current feedback values at times
|Copied from a previous bug report for version 4.x (https://tracker.ardour.org/view.php?id=6657). Issue is occurring with a AKAI MPK249 and assumably most generic MIDI controllers that receive feedback. While testing the feedback for a custom mute automation mapping, I noticed the feedback will loose sync at times with the pad's that are currently toggled. It seemed like a race condition due to the MIDI Control Out running asynchronously. Is this something that the use of atomics could fix?
Tested on revision 4.4-145-g3e3a5e1 with a nanoKONTROL2 in CC mode.
Issue: Pressing a button on the nanoKONTROL2 sends a CC message. The nanoKONTROL2 expects to receive the new status as a feedback CC message to update the corresponding status LED. This works on solo and mute for tracks but not for the record button. Feedback fails also when a nanoKONTROL2 button is bound to a toggled control in a plugin. However, the feedback is sent correctly if the control is toggled in Ardour instead of the midi device.
Looking at midicontrollable.cc, the previous control value from/to the midi device is stored in last_value. When writing midi feedback, if the value being sent is the same as last_value, feedback is aborted. What this means that none of the buttons should get feedback since the device expects to receive the same value it sent.
Why do the solo and mute buttons work then?
It turns out that MIDIControllable::midi_sense_controller sets the new value using controllable->set_value() and then uses controllable->get_value() to update last_value. However, Route::SoloControllable::set_value() and Route::MuteControllable::set_value() both put the new value in an asynchronous queue, which is why controllable->get_value() called immediately after set_value() usually returns the unchanged value instead of the new value. Now the current value is different from last_value and Ardour happily sends it as feedback.
|No tags attached.
|note: devices requiring feedback in this era (as opposed to 2000 when ardour began) generally deserve/require their own dedicated code support module. Although the feedback functionality exists, it was created for much simpler devices and I'd be surprised if it is of much use with contemporary devices.
|It seems the issue is better with using a larger buffer.
|Issue generated from: 0006657
|Note Added: 0027169
|Note Added: 0027336
|new => closed
|open => no change required