Commit a66199f5 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winecoreaudio: Move midi_in_close to the unixlib.

parent a9dec89f
......@@ -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;
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment