Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Mon, Nov 29, 2021 at 11:26:41AM +0000, Huw Davies wrote:
Signed-off-by: Huw Davies huw@codeweavers.com
dlls/winecoreaudio.drv/coremidi.c | 36 +++++++++++++++++++++++++++++++ dlls/winecoreaudio.drv/midi.c | 34 ----------------------------- 2 files changed, 36 insertions(+), 34 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index 1241a777048..38608b0851c 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -796,6 +796,36 @@ static DWORD midi_in_close(WORD dev_id, struct notify_context *notify) return MMSYSERR_NOERROR; }
+static DWORD midi_in_prepare(WORD dev_id, MIDIHDR *hdr, DWORD hdr_size) +{
- TRACE("dev_id = %d hdr = %p hdr_size = %d\n", dev_id, hdr, hdr_size);
- if (hdr_size < offsetof(MIDIHDR, dwOffset) || !hdr || !hdr->lpData)
return MMSYSERR_INVALPARAM;
- if (hdr->dwFlags & MHDR_PREPARED)
return MMSYSERR_NOERROR;
- hdr->lpNext = NULL;
- hdr->dwFlags |= MHDR_PREPARED;
- hdr->dwFlags &= ~(MHDR_DONE | MHDR_INQUEUE);
- return MMSYSERR_NOERROR;
+}
+static DWORD midi_in_unprepare(WORD dev_id, MIDIHDR *hdr, DWORD hdr_size) +{
- TRACE("dev_id = %d hdr = %p hdr_size = %d\n", dev_id, hdr, hdr_size);
- if (hdr_size < offsetof(MIDIHDR, dwOffset) || !hdr || !hdr->lpData)
return MMSYSERR_INVALPARAM;
- if (!(hdr->dwFlags & MHDR_PREPARED))
return MMSYSERR_NOERROR;
- if (hdr->dwFlags & MHDR_INQUEUE)
return MIDIERR_STILLPLAYING;
- hdr->dwFlags &= ~MHDR_PREPARED;
- return MMSYSERR_NOERROR;
+}
NTSTATUS midi_out_message(void *args) { struct midi_out_message_params *params = args; @@ -871,6 +901,12 @@ NTSTATUS midi_in_message(void *args) case MIDM_CLOSE: *params->err = midi_in_close(params->dev_id, params->notify); break;
- case MIDM_PREPARE:
*params->err = midi_in_prepare(params->dev_id, (MIDIHDR *)params->param_1, params->param_2);
break;
- case MIDM_UNPREPARE:
*params->err = midi_in_unprepare(params->dev_id, (MIDIHDR *)params->param_1, params->param_2);
default: TRACE("Unsupported message\n"); *params->err = MMSYSERR_NOTSUPPORTED;break;
diff --git a/dlls/winecoreaudio.drv/midi.c b/dlls/winecoreaudio.drv/midi.c index 3b069c9575d..9adf10953f9 100644 --- a/dlls/winecoreaudio.drv/midi.c +++ b/dlls/winecoreaudio.drv/midi.c @@ -194,36 +194,6 @@ static DWORD MIDIIn_AddBuffer(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) return MMSYSERR_NOERROR; }
-static DWORD MIDIIn_Prepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) -{
- TRACE("wDevID=%d lpMidiHdr=%p dwSize=%d\n", wDevID, lpMidiHdr, dwSize);
- if (dwSize < offsetof(MIDIHDR,dwOffset) || lpMidiHdr == 0 || lpMidiHdr->lpData == 0)
- return MMSYSERR_INVALPARAM;
- if (lpMidiHdr->dwFlags & MHDR_PREPARED)
- return MMSYSERR_NOERROR;
- lpMidiHdr->lpNext = 0;
- lpMidiHdr->dwFlags |= MHDR_PREPARED;
- lpMidiHdr->dwFlags &= ~(MHDR_DONE|MHDR_INQUEUE); /* flags cleared since w2k */
- return MMSYSERR_NOERROR;
-}
-static DWORD MIDIIn_Unprepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) -{
- TRACE("wDevID=%d lpMidiHdr=%p dwSize=%d\n", wDevID, lpMidiHdr, dwSize);
- if (dwSize < offsetof(MIDIHDR,dwOffset) || lpMidiHdr == 0 || lpMidiHdr->lpData == 0)
- return MMSYSERR_INVALPARAM;
- if (!(lpMidiHdr->dwFlags & MHDR_PREPARED))
- return MMSYSERR_NOERROR;
- if (lpMidiHdr->dwFlags & MHDR_INQUEUE)
- return MIDIERR_STILLPLAYING;
- lpMidiHdr->dwFlags &= ~MHDR_PREPARED;
- return MMSYSERR_NOERROR;
-}
static DWORD MIDIIn_GetDevCaps(WORD wDevID, LPMIDIINCAPSW lpCaps, DWORD dwSize) { TRACE("wDevID=%d lpCaps=%p dwSize=%d\n", wDevID, lpCaps, dwSize); @@ -467,10 +437,6 @@ DWORD WINAPI CoreAudio_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWOR switch (wMsg) { case MIDM_ADDBUFFER: return MIDIIn_AddBuffer(wDevID, (LPMIDIHDR)dwParam1, dwParam2);
case MIDM_PREPARE:
return MIDIIn_Prepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2);
case MIDM_UNPREPARE:
return MIDIIn_Unprepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2); case MIDM_GETDEVCAPS: return MIDIIn_GetDevCaps(wDevID, (LPMIDIINCAPSW) dwParam1, dwParam2); case MIDM_GETNUMDEVS:
-- 2.23.0