Truncate MIDI SysEx messages after termination byte

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Mon Jan 14 04:42:46 CST 2013


Hi,

Johannes Kroll wrote:
>+    for(i = 0; i < lpMidiOutHdr->dwBufferLength; i++)
>+        if((unsigned char)lpMidiOutHdr->lpData[i] == 0xF7 && i < lpMidiOutHdr->dwBufferLength-1)

What about
     for(i = 0; i+1 < lpMidiOutHdr->dwBufferLength, i++)
  without the redundant second if(&&) half?


I'm always happy when somebody with real MIDI HW speaks up, because
I'm not convinced that the Wine MIDI code does TRT about SysEx --
based on my readings, not experience, as I own no MIDI device...
In particular, do you have any experience with multi-part SysEx
messages (e.g. large data, such as uploads)?

Still, I'm not persuaded that your patch is at the right place.
I believe the midi* functions should be tiny wrappers around MODM_*
messages, same for the wave* functions.  Every time I see somebody
attempt to violate this 1:1 mapping, I'm suspicious.  Perhaps the
logic that you're adding belongs to the individual wine*.drv/midi.c?

Do you get to see this warning from winealsa.drv where it
specifically checks for a terminating F7 (but not intermediate F7)?
http://source.winehq.org/source/dlls/winealsa.drv/midi.c#L969
964     /* FIXME: MS doc is not 100% clear. Will lpData only contain system exclusive
965      * data, or can it also contain raw MIDI data, to be split up and sent to
966      * modShortData() ?
967      * If the latest is true, then the following WARNing will fire up
968      */
969     if (lpData[0] != 0xF0 || lpData[lpMidiHdr->dwBufferLength - 1] != 0xF7) {
970         WARN("Alleged system exclusive buffer is not correct\n\tPlease report with MIDI file\n");
971         lpNewData = HeapAlloc(GetProcessHeap(), 0, lpMidiHdr->dwBufferLength + 2);
972     }

Therefore, I'd be happy if you could invest some more time and check,
based on your real MIDI HW, and perhaps native w* machines,
whether MODM_LONGDATA and midiOutLongMsg are equivalent
or whether midiOut* does some additional processing.

Regards,
	Jörg Höhle


More information about the wine-devel mailing list