Commit 3d0e1a4f authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineoss: Move MIDM_PREPARE and MIDM_UNPREPARE to the unixlib.

parent b3e0d8db
......@@ -541,44 +541,6 @@ static DWORD midAddBuffer(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
}
/**************************************************************************
* midPrepare [internal]
*/
static DWORD midPrepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
{
TRACE("(%04X, %p, %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;
}
/**************************************************************************
* midUnprepare [internal]
*/
static DWORD midUnprepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
{
TRACE("(%04X, %p, %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;
}
/**************************************************************************
* midReset [internal]
*/
static DWORD midReset(WORD wDevID)
......@@ -642,6 +604,9 @@ static DWORD midStop(WORD wDevID)
DWORD WINAPI OSS_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
DWORD_PTR dwParam1, DWORD_PTR dwParam2)
{
struct midi_in_message_params params;
UINT err;
TRACE("(%04X, %04X, %08lX, %08lX, %08lX);\n",
wDevID, wMsg, dwUser, dwParam1, dwParam2);
switch (wMsg) {
......@@ -649,20 +614,12 @@ DWORD WINAPI OSS_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
return OSS_MidiInit();
case DRVM_EXIT:
return OSS_MidiExit();
case DRVM_ENABLE:
case DRVM_DISABLE:
/* FIXME: Pretend this is supported */
return 0;
case MIDM_OPEN:
return midOpen(wDevID, (LPMIDIOPENDESC)dwParam1, dwParam2);
case MIDM_CLOSE:
return midClose(wDevID);
case MIDM_ADDBUFFER:
return midAddBuffer(wDevID, (LPMIDIHDR)dwParam1, dwParam2);
case MIDM_PREPARE:
return midPrepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2);
case MIDM_UNPREPARE:
return midUnprepare(wDevID, (LPMIDIHDR)dwParam1, dwParam2);
case MIDM_GETDEVCAPS:
return midGetDevCaps(wDevID, (LPMIDIINCAPSW)dwParam1,dwParam2);
case MIDM_GETNUMDEVS:
......@@ -673,10 +630,18 @@ DWORD WINAPI OSS_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
return midStart(wDevID);
case MIDM_STOP:
return midStop(wDevID);
default:
TRACE("Unsupported message\n");
}
return MMSYSERR_NOTSUPPORTED;
params.dev_id = wDevID;
params.msg = wMsg;
params.user = dwUser;
params.param_1 = dwParam1;
params.param_2 = dwParam2;
params.err = &err;
OSS_CALL(midi_in_message, &params);
return err;
}
/**************************************************************************
......
......@@ -1407,6 +1407,7 @@ unixlib_entry_t __wine_unix_call_funcs[] =
is_started,
midi_init,
midi_out_message,
midi_in_message,
midi_seq_open,
};
......@@ -1099,6 +1099,38 @@ static UINT midi_out_reset(WORD dev_id)
return MMSYSERR_NOERROR;
}
static UINT midi_in_prepare(WORD dev_id, MIDIHDR *hdr, UINT hdr_size)
{
TRACE("(%04X, %p, %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 UINT midi_in_unprepare(WORD dev_id, MIDIHDR *hdr, UINT hdr_size)
{
TRACE("(%04X, %p, %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;
......@@ -1152,3 +1184,28 @@ NTSTATUS midi_out_message(void *args)
return STATUS_SUCCESS;
}
NTSTATUS midi_in_message(void *args)
{
struct midi_in_message_params *params = args;
switch (params->msg)
{
case DRVM_ENABLE:
case DRVM_DISABLE:
/* FIXME: Pretend this is supported */
*params->err = MMSYSERR_NOERROR;
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);
break;
default:
TRACE("Unsupported message\n");
*params->err = MMSYSERR_NOTSUPPORTED;
}
return STATUS_SUCCESS;
}
......@@ -256,6 +256,16 @@ struct midi_out_message_params
struct notify_context *notify;
};
struct midi_in_message_params
{
UINT dev_id;
UINT msg;
UINT_PTR user;
UINT_PTR param_1;
UINT_PTR param_2;
UINT *err;
};
struct midi_seq_open_params
{
int close;
......@@ -289,12 +299,14 @@ enum oss_funcs
oss_is_started,
oss_midi_init,
oss_midi_out_message,
oss_midi_in_message,
oss_midi_seq_open, /* temporary */
};
NTSTATUS midi_init(void *args) DECLSPEC_HIDDEN;
NTSTATUS midi_out_message(void *args) DECLSPEC_HIDDEN;
NTSTATUS midi_in_message(void *args) DECLSPEC_HIDDEN;
NTSTATUS midi_seq_open(void *args) DECLSPEC_HIDDEN;
extern unixlib_handle_t oss_handle;
......
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