Closed Harvie closed 5 years ago
Hey, thank you for the submission! This is a neat example!
Before merging this, I'd like to rename variable 'channel' to 'velocity' (the MIDI channel is in the command byte, it can be accessed by doing u8 channel = command & 0x0f
), then in the if
below, I think 'velocity' should be checked for 0 instead of pitch.
There is a possibility for note on / off messages to be missed when the incoming MIDI data contains other kinds of MIDI messages than 3-byte ones, (like program change or sysex) but after the buffer is exhausted, MIDI parsing will then continue to work. For the sake of simplicity, I think it's OK to keep it as is, but if you'd like to know more on why and how to solve it, let me know. :)
I think it's OK to keep it as is, but if you'd like to know more on why and how to solve it, let me know
Yes, i've been reusing MIDI parsing code that i've written back in 2012. Yesterday i was trying to implement more complex polyphonic synth and i became aware of the problems. I can modify it. And maybe i will add pitch bend.
What about now? I wasn't able to complete the pitchbend code, mainly because i don't have have any software to send PB messages at hand... But the parsing code should be cleaner now...
BTW do you support sending and receiving SysEx? Haven't tried it yet, but i will need that soon...
BTW do you support sending and receiving SysEx? Haven't tried it yet, but i will need that soon...
Yes, SysEx is supported. Important thing to know is that during SysEx transfer, MIDI 'real time' messages such as tempo sync (0xf8) and start / stop, etc..., are allowed to be intermixed with the SysEx data.
Important thing to know is that during SysEx transfer, MIDI 'real time' messages such as tempo sync (0xf8) and start / stop, etc..., are allowed to be intermixed with the SysEx data.
I guess, you can easily tell and filter them by 0b10000000 set
I guess, you can easily tell and filter them by 0b10000000 set
0x80 bit is always set for all MIDI command bytes. Real time command byte is always >= 0xf8.
Ok, thank you for fixing the issues :)
check this out :-)