Commit 90800f46 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineoss: Move MIDM_ADDBUFFER to the unixlib.

parent b2eb6ed4
...@@ -491,42 +491,6 @@ static DWORD midClose(WORD wDevID) ...@@ -491,42 +491,6 @@ static DWORD midClose(WORD wDevID)
} }
/************************************************************************** /**************************************************************************
* midAddBuffer [internal]
*/
static DWORD midAddBuffer(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
{
TRACE("(%04X, %p, %d);\n", wDevID, lpMidiHdr, dwSize);
if (wDevID >= MIDM_NumDevs) return MMSYSERR_BADDEVICEID;
if (MidiInDev[wDevID].state == -1) return MIDIERR_NODEVICE;
if (lpMidiHdr == NULL) return MMSYSERR_INVALPARAM;
if (dwSize < offsetof(MIDIHDR,dwOffset)) return MMSYSERR_INVALPARAM;
if (lpMidiHdr->dwBufferLength == 0) return MMSYSERR_INVALPARAM;
if (lpMidiHdr->dwFlags & MHDR_INQUEUE) return MIDIERR_STILLPLAYING;
if (!(lpMidiHdr->dwFlags & MHDR_PREPARED)) return MIDIERR_UNPREPARED;
in_buffer_lock();
lpMidiHdr->dwFlags &= ~WHDR_DONE;
lpMidiHdr->dwFlags |= MHDR_INQUEUE;
lpMidiHdr->dwBytesRecorded = 0;
lpMidiHdr->lpNext = 0;
if (MidiInDev[wDevID].lpQueueHdr == 0) {
MidiInDev[wDevID].lpQueueHdr = lpMidiHdr;
} else {
LPMIDIHDR ptr;
for (ptr = MidiInDev[wDevID].lpQueueHdr;
ptr->lpNext != 0;
ptr = ptr->lpNext);
ptr->lpNext = lpMidiHdr;
}
in_buffer_unlock();
return MMSYSERR_NOERROR;
}
/**************************************************************************
* midReset [internal] * midReset [internal]
*/ */
static DWORD midReset(WORD wDevID) static DWORD midReset(WORD wDevID)
...@@ -604,8 +568,6 @@ DWORD WINAPI OSS_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, ...@@ -604,8 +568,6 @@ DWORD WINAPI OSS_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
return midOpen(wDevID, (LPMIDIOPENDESC)dwParam1, dwParam2); return midOpen(wDevID, (LPMIDIOPENDESC)dwParam1, dwParam2);
case MIDM_CLOSE: case MIDM_CLOSE:
return midClose(wDevID); return midClose(wDevID);
case MIDM_ADDBUFFER:
return midAddBuffer(wDevID, (LPMIDIHDR)dwParam1, dwParam2);
case MIDM_RESET: case MIDM_RESET:
return midReset(wDevID); return midReset(wDevID);
case MIDM_START: case MIDM_START:
......
...@@ -1120,6 +1120,38 @@ static UINT midi_out_reset(WORD dev_id) ...@@ -1120,6 +1120,38 @@ static UINT midi_out_reset(WORD dev_id)
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
} }
static UINT midi_in_add_buffer(WORD dev_id, MIDIHDR *hdr, UINT hdr_size)
{
struct midi_src *src;
MIDIHDR **next;
TRACE("(%04X, %p, %d);\n", dev_id, hdr, hdr_size);
if (dev_id >= num_srcs) return MMSYSERR_BADDEVICEID;
src = srcs + dev_id;
if (src->state == -1) return MIDIERR_NODEVICE;
if (!hdr || hdr_size < offsetof(MIDIHDR, dwOffset) || !hdr->dwBufferLength)
return MMSYSERR_INVALPARAM;
if (hdr->dwFlags & MHDR_INQUEUE) return MIDIERR_STILLPLAYING;
if (!(hdr->dwFlags & MHDR_PREPARED)) return MIDIERR_UNPREPARED;
in_buffer_lock();
hdr->dwFlags &= ~WHDR_DONE;
hdr->dwFlags |= MHDR_INQUEUE;
hdr->dwBytesRecorded = 0;
hdr->lpNext = NULL;
next = &src->lpQueueHdr;
while (*next) next = &(*next)->lpNext;
*next = hdr;
in_buffer_unlock();
return MMSYSERR_NOERROR;
}
static UINT midi_in_prepare(WORD dev_id, MIDIHDR *hdr, UINT hdr_size) static UINT midi_in_prepare(WORD dev_id, MIDIHDR *hdr, UINT hdr_size)
{ {
TRACE("(%04X, %p, %d);\n", dev_id, hdr, hdr_size); TRACE("(%04X, %p, %d);\n", dev_id, hdr, hdr_size);
...@@ -1229,6 +1261,9 @@ NTSTATUS midi_in_message(void *args) ...@@ -1229,6 +1261,9 @@ NTSTATUS midi_in_message(void *args)
/* FIXME: Pretend this is supported */ /* FIXME: Pretend this is supported */
*params->err = MMSYSERR_NOERROR; *params->err = MMSYSERR_NOERROR;
break; break;
case MIDM_ADDBUFFER:
*params->err = midi_in_add_buffer(params->dev_id, (MIDIHDR *)params->param_1, params->param_2);
break;
case MIDM_PREPARE: case MIDM_PREPARE:
*params->err = midi_in_prepare(params->dev_id, (MIDIHDR *)params->param_1, params->param_2); *params->err = midi_in_prepare(params->dev_id, (MIDIHDR *)params->param_1, params->param_2);
break; break;
......
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