I had a similar problem with iOS. You are right, the number of MIDI packets is always 1.
In my case, when you receive multiple MIDI events with the same timestamp (received MIDI events at the same time), iOS does not break these few MIDI events in multiple packets as expected.
But, fortunately, nothing is lost! Indeed, instead of receiving several packets with their correct number of bytes, you will receive one packet with several events in it, and the number of bytes will be increased accordingly.
So here is what you need to do:
In your MIDI IN callback, analyze all the packets received (always 1 for iOS), then for each packet you receive, you need to check the packet length and MIDI status, and then loop into that packet to get all the MIDI events in the current packet.
For example, if a packet contains 9 bytes, and the MIDI status is an ON note (3 byte message), it means that your current packet contains more than one ON note, you should then parse the first ON note (bytes 0 to 2), then check MIDI state from byte 3, etc.
Hope this helps ...
Jerome
source share