Closed essej closed 4 years ago
Just wanted to chime in; I've used the unpatched library with a Teensy 3.6 and a 4.0 and ran into lost MIDI transmissions quite a bit, even when playing something like arpeggios regularly. It was even worse with an MPE controller where a lot more MIDI data is being sent. NoteOff and botched pitch bend messages were the main things I've witnessed. This patch fixed those issues; I've reapplied the changes to the current head and I haven't seen any problems even with MPE controllers after a couple of minutes of testing.
Yes, I was testing with MPE controllers and discovered this bug immediately. Paul, if you are there, please merge this request for the good of others!
Ok, merging now.
Thank you both very much!
Great, thanks!
Fixed race condition in midi transmit that could happen with heavy write traffic, in combination with reading. This would lock up the usb host device, when it happened. Disabling interrupts around access to the data queue in write_packed() matches what read() is already doing, so this seems like the correct solution.