[PATCH] [RFC] winecoreaudio: Handle MIDI running status.
Not compile tested. Andrew, could you try this patch on Mac? --- dlls/winecoreaudio.drv/coremidi.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)
Hi Akihiro, Yes, this patch builds fine for me on macOS. Andrew On Thu, May 26, 2022 at 11:38:53PM +0900, Akihiro Sagawa wrote:
Not compile tested. Andrew, could you try this patch on Mac?
--- dlls/winecoreaudio.drv/coremidi.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index 998b8f1bd46..c8487508dff 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -103,6 +103,7 @@ struct midi_dest
MIDIOUTCAPSW caps; MIDIOPENDESC midiDesc; + BYTE runningStatus; WORD wFlags; };
@@ -598,6 +599,7 @@ static DWORD midi_out_open(WORD dev_id, MIDIOPENDESC *midi_desc, DWORD flags, st return MMSYSERR_ERROR; } } + dest->runningStatus = 0; dest->wFlags = HIWORD(flags & CALLBACK_TYPEMASK); dest->midiDesc = *midi_desc;
@@ -655,12 +657,30 @@ static DWORD midi_out_data(WORD dev_id, DWORD data) WARN("bad device ID : %d\n", dev_id); return MMSYSERR_BADDEVICEID; } + dest = dests + dev_id;
bytes[0] = data & 0xff; - bytes[1] = (data >> 8) & 0xff; - bytes[2] = (data >> 16) & 0xff; + if (bytes[0] & 0x80) + { + bytes[1] = (data >> 8) & 0xff; + bytes[2] = (data >> 16) & 0xff; + if (bytes[0] < 0xF0) + dest->runningStatus = bytes[0]; + else if (bytes[0] <= 0xF7) + dest->runningStatus = 0; + } + else if (dest->runningStatus) + { + bytes[0] = dest->runningStatus; + bytes[1] = data & 0xff; + bytes[2] = (data >> 8) & 0xff; + } + else + { + FIXME("ooch %x\n", data); + return MMSYSERR_NOERROR; + }
- dest = dests + dev_id; if (dest->caps.wTechnology == MOD_SYNTH) { sc = MusicDeviceMIDIEvent(dest->synth, bytes[0], bytes[1], bytes[2], 0); @@ -726,6 +746,7 @@ static DWORD midi_out_long_data(WORD dev_id, MIDIHDR *hdr, DWORD hdr_size, struc else if (dest->caps.wTechnology == MOD_MIDIPORT) midi_send(midi_out_port, dest->dest, (UInt8 *)hdr->lpData, hdr->dwBufferLength);
+ dest->runningStatus = 0; hdr->dwFlags &= ~MHDR_INQUEUE; hdr->dwFlags |= MHDR_DONE;
@@ -866,6 +887,8 @@ static DWORD midi_out_reset(WORD dev_id) } else FIXME("MOD_MIDIPORT\n");
+ dests[dev_id].runningStatus = 0; + /* FIXME: the LongData buffers must also be returned to the app */ return MMSYSERR_NOERROR; }
participants (2)
-
Akihiro Sagawa -
Andrew Eikum