Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/winecoreaudio.drv/coremidi.c | 29 +++++++++++++++++++++++++++++ dlls/winecoreaudio.drv/midi.c | 27 --------------------------- 2 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index 6a8324f276e..1241a777048 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -770,6 +770,32 @@ static DWORD midi_in_open(WORD dev_id, MIDIOPENDESC *midi_desc, DWORD flags, str return MMSYSERR_NOERROR; }
+static DWORD midi_in_close(WORD dev_id, struct notify_context *notify) +{ + struct midi_src *src; + + TRACE("dev_id = %d\n", dev_id); + + if (dev_id >= num_srcs) + { + WARN("bad device ID : %d\n", dev_id); + return MMSYSERR_BADDEVICEID; + } + src = srcs + dev_id; + + if (!src->midiDesc.hMidi) + { + WARN("device not opened !\n"); + return MMSYSERR_ERROR; + } + if (src->lpQueueHdr) return MIDIERR_STILLPLAYING; + + set_in_notify(notify, src, dev_id, MIM_CLOSE, 0, 0); + src->midiDesc.hMidi = 0; + + return MMSYSERR_NOERROR; +} + NTSTATUS midi_out_message(void *args) { struct midi_out_message_params *params = args; @@ -842,6 +868,9 @@ NTSTATUS midi_in_message(void *args) case MIDM_OPEN: *params->err = midi_in_open(params->dev_id, (MIDIOPENDESC *)params->param_1, params->param_2, params->notify); break; + case MIDM_CLOSE: + *params->err = midi_in_close(params->dev_id, params->notify); + 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 4063fe3c10e..3b069c9575d 100644 --- a/dlls/winecoreaudio.drv/midi.c +++ b/dlls/winecoreaudio.drv/midi.c @@ -128,7 +128,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, DWORD_PTR dwParam1, DWORD_ TRACE("wDevID=%d wMsg=%d dwParm1=%04lX dwParam2=%04lX\n", wDevID, wMsg, dwParam1, dwParam2);
switch (wMsg) { - case MIM_CLOSE: case MIM_DATA: case MIM_LONGDATA: case MIM_ERROR: @@ -147,30 +146,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, DWORD_PTR dwParam1, DWORD_ DriverCallback(dwCallBack, uFlags, hDev, wMsg, dwInstance, dwParam1, dwParam2); }
-static DWORD MIDIIn_Close(WORD wDevID) -{ - DWORD ret = MMSYSERR_NOERROR; - - TRACE("wDevID=%d\n", wDevID); - - if (wDevID >= MIDIIn_NumDevs) { - WARN("bad device ID : %d\n", wDevID); - return MMSYSERR_BADDEVICEID; - } - - if (sources[wDevID].midiDesc.hMidi == 0) { - WARN("device not opened !\n"); - return MMSYSERR_ERROR; - } - if (sources[wDevID].lpQueueHdr != 0) { - return MIDIERR_STILLPLAYING; - } - - MIDI_NotifyClient(wDevID, MIM_CLOSE, 0L, 0L); - sources[wDevID].midiDesc.hMidi = 0; - return ret; -} - static DWORD MIDIIn_AddBuffer(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) { TRACE("wDevID=%d lpMidiHdr=%p dwSize=%d\n", wDevID, lpMidiHdr, dwSize); @@ -490,8 +465,6 @@ DWORD WINAPI CoreAudio_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWOR
TRACE("%d %08x %08lx %08lx %08lx\n", wDevID, wMsg, dwUser, dwParam1, dwParam2); switch (wMsg) { - case MIDM_CLOSE: - return MIDIIn_Close(wDevID); case MIDM_ADDBUFFER: return MIDIIn_AddBuffer(wDevID, (LPMIDIHDR)dwParam1, dwParam2); case MIDM_PREPARE:
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Mon, Nov 29, 2021 at 11:26:40AM +0000, Huw Davies wrote:
Signed-off-by: Huw Davies huw@codeweavers.com
dlls/winecoreaudio.drv/coremidi.c | 29 +++++++++++++++++++++++++++++ dlls/winecoreaudio.drv/midi.c | 27 --------------------------- 2 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index 6a8324f276e..1241a777048 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -770,6 +770,32 @@ static DWORD midi_in_open(WORD dev_id, MIDIOPENDESC *midi_desc, DWORD flags, str return MMSYSERR_NOERROR; }
+static DWORD midi_in_close(WORD dev_id, struct notify_context *notify) +{
- struct midi_src *src;
- TRACE("dev_id = %d\n", dev_id);
- if (dev_id >= num_srcs)
- {
WARN("bad device ID : %d\n", dev_id);
return MMSYSERR_BADDEVICEID;
- }
- src = srcs + dev_id;
- if (!src->midiDesc.hMidi)
- {
WARN("device not opened !\n");
return MMSYSERR_ERROR;
- }
- if (src->lpQueueHdr) return MIDIERR_STILLPLAYING;
- set_in_notify(notify, src, dev_id, MIM_CLOSE, 0, 0);
- src->midiDesc.hMidi = 0;
- return MMSYSERR_NOERROR;
+}
NTSTATUS midi_out_message(void *args) { struct midi_out_message_params *params = args; @@ -842,6 +868,9 @@ NTSTATUS midi_in_message(void *args) case MIDM_OPEN: *params->err = midi_in_open(params->dev_id, (MIDIOPENDESC *)params->param_1, params->param_2, params->notify); break;
- case MIDM_CLOSE:
*params->err = midi_in_close(params->dev_id, params->notify);
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 4063fe3c10e..3b069c9575d 100644 --- a/dlls/winecoreaudio.drv/midi.c +++ b/dlls/winecoreaudio.drv/midi.c @@ -128,7 +128,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, DWORD_PTR dwParam1, DWORD_ TRACE("wDevID=%d wMsg=%d dwParm1=%04lX dwParam2=%04lX\n", wDevID, wMsg, dwParam1, dwParam2);
switch (wMsg) {
- case MIM_CLOSE: case MIM_DATA: case MIM_LONGDATA: case MIM_ERROR:
@@ -147,30 +146,6 @@ static void MIDI_NotifyClient(UINT wDevID, WORD wMsg, DWORD_PTR dwParam1, DWORD_ DriverCallback(dwCallBack, uFlags, hDev, wMsg, dwInstance, dwParam1, dwParam2); }
-static DWORD MIDIIn_Close(WORD wDevID) -{
- DWORD ret = MMSYSERR_NOERROR;
- TRACE("wDevID=%d\n", wDevID);
- if (wDevID >= MIDIIn_NumDevs) {
WARN("bad device ID : %d\n", wDevID);
- return MMSYSERR_BADDEVICEID;
- }
- if (sources[wDevID].midiDesc.hMidi == 0) {
- WARN("device not opened !\n");
- return MMSYSERR_ERROR;
- }
- if (sources[wDevID].lpQueueHdr != 0) {
- return MIDIERR_STILLPLAYING;
- }
- MIDI_NotifyClient(wDevID, MIM_CLOSE, 0L, 0L);
- sources[wDevID].midiDesc.hMidi = 0;
- return ret;
-}
static DWORD MIDIIn_AddBuffer(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) { TRACE("wDevID=%d lpMidiHdr=%p dwSize=%d\n", wDevID, lpMidiHdr, dwSize); @@ -490,8 +465,6 @@ DWORD WINAPI CoreAudio_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWOR
TRACE("%d %08x %08lx %08lx %08lx\n", wDevID, wMsg, dwUser, dwParam1, dwParam2); switch (wMsg) {
case MIDM_CLOSE:
return MIDIIn_Close(wDevID); case MIDM_ADDBUFFER: return MIDIIn_AddBuffer(wDevID, (LPMIDIHDR)dwParam1, dwParam2); case MIDM_PREPARE:
-- 2.23.0