While these could be left on the user-side, it seems simplest to move everything across.
Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/winecoreaudio.drv/coremidi.c | 36 ++++++++++++++++++++++++++++ dlls/winecoreaudio.drv/midi.c | 40 ------------------------------- 2 files changed, 36 insertions(+), 40 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index d80b8c1711b..3a560c21d74 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -565,6 +565,36 @@ static DWORD midi_out_long_data(WORD dev_id, MIDIHDR *hdr, DWORD hdr_size, struc return MMSYSERR_NOERROR; }
+static DWORD midi_out_prepare(WORD dev_id, MIDIHDR *hdr, DWORD hdr_size) +{ + TRACE("dev_id = %d midi_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 = 0; + hdr->dwFlags |= MHDR_PREPARED; + hdr->dwFlags &= ~(MHDR_DONE | MHDR_INQUEUE); + return MMSYSERR_NOERROR; +} + +static DWORD midi_out_unprepare(WORD dev_id, MIDIHDR *hdr, DWORD hdr_size) +{ + TRACE("dev_id = %d midi_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; @@ -591,6 +621,12 @@ NTSTATUS midi_out_message(void *args) case MODM_LONGDATA: *params->err = midi_out_long_data(params->dev_id, (MIDIHDR *)params->param_1, params->param_2, params->notify); break; + case MODM_PREPARE: + *params->err = midi_out_prepare(params->dev_id, (MIDIHDR *)params->param_1, params->param_2); + break; + case MODM_UNPREPARE: + *params->err = midi_out_unprepare(params->dev_id, (MIDIHDR *)params->param_1, params->param_2); + break; default: TRACE("Unsupported message\n"); *params->err = MMSYSERR_NOTSUPPORTED; diff --git a/dlls/winecoreaudio.drv/midi.c b/dlls/winecoreaudio.drv/midi.c index 589a08e0907..71bd7afebdf 100644 --- a/dlls/winecoreaudio.drv/midi.c +++ b/dlls/winecoreaudio.drv/midi.c @@ -155,42 +155,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, DWORD_PTR dwParam1, DWORD_ DriverCallback(dwCallBack, uFlags, hDev, wMsg, dwInstance, dwParam1, dwParam2); }
-/************************************************************************** - * MIDIOut_Prepare [internal] - */ -static DWORD MIDIOut_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; -} - -/************************************************************************** - * MIDIOut_Unprepare [internal] - */ -static DWORD MIDIOut_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 MIDIOut_GetDevCaps(WORD wDevID, LPMIDIOUTCAPSW lpCaps, DWORD dwSize) { TRACE("wDevID=%d lpCaps=%p dwSize=%d\n", wDevID, lpCaps, dwSize); @@ -642,10 +606,6 @@ DWORD WINAPI CoreAudio_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWOR TRACE("%d %08x %08lx %08lx %08lx\n", wDevID, wMsg, dwUser, dwParam1, dwParam2);
switch (wMsg) { - case MODM_PREPARE: - return MIDIOut_Prepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2); - case MODM_UNPREPARE: - return MIDIOut_Unprepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2); case MODM_GETDEVCAPS: return MIDIOut_GetDevCaps(wDevID, (LPMIDIOUTCAPSW) dwParam1, dwParam2); case MODM_GETNUMDEVS: