Calling `Pm_Write` with length zero seems to write last message again
Opened this issue · 1 comments
I have some code that calls Pm_Write
unconditionally, but mostly with the length
parameter set to 0.
Until recently, this wasn't an issue, but now it seems that it re-sends the latest message. Is this expected behaviour?
To fix it, I simply make sure not to call Pm_Write
with a zero length, which is probably the sane choice anyway.
I'm not sure when this new behaviour was introduced, but I'm currently using libportmidi v2.0.3, installed via Homebrew on an M1 Mac.
I added a test to pm_test/testio.c, but cannot reproduce this behavior on an M2 machine, and the code in Pm_Write seems clear: for (i = 0; i < length; i++) { ...
Of course, it's conceivable that something else is sending a message, but I don't see how. Are you sending short messages (not SysEx)? I don't control HomeBrew, so it might also be interesting to compile from PortMidi sources. You should be able to simply drop the C files into your project if you don't want to create a separate library or worry about conflicts with homebrew.