lhl2617 / VSLilyPond

VSCode Extension for LilyPond
https://marketplace.visualstudio.com/items?itemName=lhl2617.vslilypond
93 stars 7 forks source link

Calculate the midi status type regardless of channel #349

Closed paradox460 closed 3 years ago

paradox460 commented 3 years ago

The previous implementation (71300a0) used 0x80 and 0x90 comparisons directly, which meant any midi device set to use a different channel would not be seen by the plugin.

This is because a statusByte is defined as two sets of nibbles.

0x91 = 1001 0001
         9    1

    1001 0001
    Type Channel

The first nibble is what we care about, the type of message. The second is the channel, from 0 to 15.

So by using a simple bitmask, we can discard the channel information, and our checks continue to work

lhl2617 commented 3 years ago

This is amazing, thank you so much for reading into the MIDI spec much closer than I did!