Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/wineoss.drv/midi.c | 63 +++++++++----------------------------- dlls/wineoss.drv/oss.c | 1 + dlls/wineoss.drv/ossmidi.c | 57 ++++++++++++++++++++++++++++++++++ dlls/wineoss.drv/unixlib.h | 12 ++++++++ 4 files changed, 84 insertions(+), 49 deletions(-)
diff --git a/dlls/wineoss.drv/midi.c b/dlls/wineoss.drv/midi.c index 470e8e4403d..ab68d7c8d25 100644 --- a/dlls/wineoss.drv/midi.c +++ b/dlls/wineoss.drv/midi.c @@ -540,44 +540,6 @@ static DWORD midAddBuffer(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) return MMSYSERR_NOERROR; }
-/************************************************************************** - * 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] */ @@ -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, ¶ms); + + return err; }
/************************************************************************** diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index db2f705a0c5..aab7c5a32d6 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -1407,6 +1407,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = is_started, midi_init, midi_out_message, + midi_in_message,
midi_seq_open, }; diff --git a/dlls/wineoss.drv/ossmidi.c b/dlls/wineoss.drv/ossmidi.c index ba3017a5ad7..6b8de674b7b 100644 --- a/dlls/wineoss.drv/ossmidi.c +++ b/dlls/wineoss.drv/ossmidi.c @@ -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; +} diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h index 183f5017d04..c86bc3450df 100644 --- a/dlls/wineoss.drv/unixlib.h +++ b/dlls/wineoss.drv/unixlib.h @@ -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;
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Tue, Apr 26, 2022 at 07:27:58AM +0100, Huw Davies wrote:
Signed-off-by: Huw Davies huw@codeweavers.com
dlls/wineoss.drv/midi.c | 63 +++++++++----------------------------- dlls/wineoss.drv/oss.c | 1 + dlls/wineoss.drv/ossmidi.c | 57 ++++++++++++++++++++++++++++++++++ dlls/wineoss.drv/unixlib.h | 12 ++++++++ 4 files changed, 84 insertions(+), 49 deletions(-)
diff --git a/dlls/wineoss.drv/midi.c b/dlls/wineoss.drv/midi.c index 470e8e4403d..ab68d7c8d25 100644 --- a/dlls/wineoss.drv/midi.c +++ b/dlls/wineoss.drv/midi.c @@ -540,44 +540,6 @@ static DWORD midAddBuffer(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) return MMSYSERR_NOERROR; }
-/**************************************************************************
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]
*/ @@ -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, ¶ms);
- return err;
}
/************************************************************************** diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index db2f705a0c5..aab7c5a32d6 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -1407,6 +1407,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = is_started, midi_init, midi_out_message,
midi_in_message,
midi_seq_open,
}; diff --git a/dlls/wineoss.drv/ossmidi.c b/dlls/wineoss.drv/ossmidi.c index ba3017a5ad7..6b8de674b7b 100644 --- a/dlls/wineoss.drv/ossmidi.c +++ b/dlls/wineoss.drv/ossmidi.c @@ -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;
+} diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h index 183f5017d04..c86bc3450df 100644 --- a/dlls/wineoss.drv/unixlib.h +++ b/dlls/wineoss.drv/unixlib.h @@ -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;
2.25.1