lathoub / Arduino-AppleMIDI-Library

Send and receive MIDI messages over Ethernet (rtpMIDI or AppleMIDI)
Other
306 stars 66 forks source link

fixed pitch bend byte order and offset #56

Closed massimofasciano closed 6 years ago

massimofasciano commented 6 years ago

Fixes 2 issues with the decoding of incoming pitch bend events.

In packet-rtp-midi.h, the following line int pitch = ( octet1 << 7 ) | octet2; is replaced with int pitch = (( octet2 << 7 ) | octet1) - 8192;

This should correct both issues:

1) the 2 octets (high and low) were reversed (low appears first in the midi stream) 2) the 8192 negative offset was not applied to get a signed int (midi encodes from 0 to 16383 but we expect -8192 to 8191)