MIDIUSB icon indicating copy to clipboard operation
MIDIUSB copied to clipboard

fixed midi input event loss issue with high data rates

Open essej opened this issue 9 years ago • 1 comments
trafficstars

While receiving midi packets from a high-rate stream (such as from an expressive controller like a Continuum, Seaboard, Linnstrument, etc) I discovered that the low-level USB_Recv() call when asked to read only the next 4 bytes (as it was being used before my patch) apparently throws away any other data sitting in its USB recv queue at the time, instead of returning the next 4 bytes on the next call as presumably expected. The solution is to allow it to read more data at once if available, in my testing reading up to 8 events (32 bytes) was more than enough to handle what I was throwing at it in a stress test. USB_Recv only returns what it actually reads. However, with large sysex I wouldn't be surprised for it to require more, probably the right thing to do is allow up to MIDI_BUFFER_SIZE, but I didn't want to impose that kind of extra memory use for the temporary read buffer.

essej avatar May 12 '16 02:05 essej

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Apr 09 '21 13:04 CLAassistant

Superseded by #109.

aentinger avatar Mar 05 '24 09:03 aentinger