cwilso / WebMIDIAPIShim

Polyfill using the Jazz NPAPI MIDI plugin to implement the Web MIDI API on Mac and Windows.
380 stars 53 forks source link

Incomplete message received #38

Closed bjornm closed 10 years ago

bjornm commented 10 years ago

Hi! The shim works fine most of the time, but I've recieved incomplete midi messages a few times, e.g. [191, 85] - there should be a third byte but there isn't.

Due to jazz plugin bug or due to splitting code in shim?

notator commented 10 years ago

I've been using jazz and the shim a lot, and my code would throw an "index out of range" exception if it received a message like that.

Maybe its a faulty cable?

notator commented 10 years ago

Ooops. My code would not throw an "index out of range" exception, it would set data[2] to 0. It would treat the above message as [191, 85, 0], which would set controller number 85 to 0. Actually there isn't a controller 85, as far as I can see, so maybe you are losing more bits than you think...

I still think its probably a faulty cable.

bjornm commented 10 years ago

Yes - after looking at the shim code, it seems it only passes on what Jazz sends. So, depending on how Jazz works and how data is received from the MIDI device, I would expect either a) Jazz always receives complete messages passed on from lower levels (meaning error in midi device), or b) buffering until a complete message has arrived before flushing the buffer (meaning jazz might not properly flush buffers).

But you are right, it's probably the cable. I will try another one and get back when I have more info.

cwilso commented 10 years ago

Yeah, this is really just passing on what it receives, and Jazz is too. It's likely a cable problem.