https://bugs.winehq.org/show_bug.cgi?id=51979
Bug ID: 51979 Summary: Sending of Midi SysEx Events not working Product: Wine Version: 6.20 Hardware: x86-64 OS: Mac OS X Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: reinhold.hoffmann@hotmail.com
The sending of midi SysEx events to an external device like a keyboard fails. SysEx events are very common like all the midi reset events.
Component: dlls\winecoreaudio.drv File: midi.c
This is related to coreaudio, alsa is OK.ยด
The issue is that SysEx events are encapsulated by 0xF0, 0xF7. These encapsulated bytes are stripped before the routine MIDIOut_LongData is called.
In MIDIOut_LongData the following happens:
Warning "The allegedly system exclusive buffer is not correct. Please report with MIDI file" Errors "Add missing 0xF0 marker at the beginning of system exclusive byte stream" "Add missing 0xF7 marker at the end of system exclusive byte stream"
But the event is being sent to the external port as if the encapsulated bytes would exist. I use a Yamaha keyboard. This macOS driver has been recently upgraded for macOS Big Sur, Monterey. This driver now fails.
================================
Comparing the same situation for the alsa driver
Component: dlls\winealsa.drv File: midi.c
The equivalent to MIDIOut_LongData of coreaudio here is modLongData. In modLongData the encapsulated bytes are added in case they are missing.
I recommend to add the same tolerant step to MIDIOut_LongData as well.
Unfortunately, tracing of a midi file was not possible because both routines crash when trace is active for dwBufferLength=2 which is a regular case even for long midi data.
Further, there is a comment in both files "but it seems to be used only for midi input". This is not the case. LongData are used for midi out, too.
https://bugs.winehq.org/show_bug.cgi?id=51979
--- Comment #1 from Reinhold reinhold.hoffmann@hotmail.com --- I need to revise my statement to some extent according to the Microsoft specs:
MODM_LONGDATA The spec says: "This data block typically contains one or more MIDI events, including system-exclusive events." See https://docs.microsoft.com/en-us/previous-versions/windows/hardware/drivers/...) which means that any SysEx event comes with MODM_LONGDATA but there are other Midi events possible here which do not have the encapsulating bytes F0, F7. The length can be any. Or, extremely it can also contain just one small Midi event with minimal length e.g. =2. For example a Program Change (2 bytes) can be sent in the format MODM_LONGDATA.
MODM_DATA The regular short message. See https://docs.microsoft.com/en-us/previous-versions/windows/hardware/drivers/...)
This means that for Component: dlls\winecoreaudio.drv File: midi.c just the errors and warnings are not correct. The trace need to be fixed.
for Component: dlls\winealsa.drv File: midi.c inserting F0, F7 when not present is not correct. The trace needs to be fixed, too.
These are my 2 cents. I am not an expert. Such an expert needs to check the issue, too.