From 05731b14d30107e73027aad2d9480a2f31450cf9 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Mon, 29 Nov 2021 11:26:44 +0000 Subject: [PATCH] winecoreaudio: Move midi_in_start and midi_in_stop to the unixlib. Signed-off-by: Huw Davies Signed-off-by: Andrew Eikum Signed-off-by: Alexandre Julliard --- dlls/winecoreaudio.drv/coremidi.c | 33 +++++++++++++++++++++++++++++++ dlls/winecoreaudio.drv/midi.c | 28 -------------------------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/dlls/winecoreaudio.drv/coremidi.c b/dlls/winecoreaudio.drv/coremidi.c index eae68ec153e..0e146ce86f6 100644 --- a/dlls/winecoreaudio.drv/coremidi.c +++ b/dlls/winecoreaudio.drv/coremidi.c @@ -851,6 +851,33 @@ static DWORD midi_in_get_num_devs(void) return num_srcs; } +static DWORD midi_in_start(WORD dev_id) +{ + TRACE("%d\n", dev_id); + + if (dev_id >= num_srcs) + { + WARN("bad device ID : %d\n", dev_id); + return MMSYSERR_BADDEVICEID; + } + srcs[dev_id].state = 1; + srcs[dev_id].startTime = NtGetTickCount(); + return MMSYSERR_NOERROR; +} + +static DWORD midi_in_stop(WORD dev_id) +{ + TRACE("%d\n", dev_id); + + if (dev_id >= num_srcs) + { + WARN("bad device ID : %d\n", dev_id); + return MMSYSERR_BADDEVICEID; + } + srcs[dev_id].state = 0; + return MMSYSERR_NOERROR; +} + NTSTATUS midi_out_message(void *args) { struct midi_out_message_params *params = args; @@ -938,6 +965,12 @@ NTSTATUS midi_in_message(void *args) case MIDM_GETNUMDEVS: *params->err = midi_in_get_num_devs(); break; + case MIDM_START: + *params->err = midi_in_start(params->dev_id); + break; + case MIDM_STOP: + *params->err = midi_in_stop(params->dev_id); + 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 6456568be85..559aae2f939 100644 --- a/dlls/winecoreaudio.drv/midi.c +++ b/dlls/winecoreaudio.drv/midi.c @@ -194,30 +194,6 @@ static DWORD MIDIIn_AddBuffer(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) return MMSYSERR_NOERROR; } -static DWORD MIDIIn_Start(WORD wDevID) -{ - TRACE("%d\n", wDevID); - - if (wDevID >= MIDIIn_NumDevs) { - WARN("bad device ID : %d\n", wDevID); - return MMSYSERR_BADDEVICEID; - } - sources[wDevID].state = 1; - sources[wDevID].startTime = GetTickCount(); - return MMSYSERR_NOERROR; -} - -static DWORD MIDIIn_Stop(WORD wDevID) -{ - TRACE("%d\n", wDevID); - if (wDevID >= MIDIIn_NumDevs) { - WARN("bad device ID : %d\n", wDevID); - return MMSYSERR_BADDEVICEID; - } - sources[wDevID].state = 0; - return MMSYSERR_NOERROR; -} - static DWORD MIDIIn_Reset(WORD wDevID) { DWORD dwTime = GetTickCount(); @@ -414,10 +390,6 @@ DWORD WINAPI CoreAudio_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWOR switch (wMsg) { case MIDM_ADDBUFFER: return MIDIIn_AddBuffer(wDevID, (LPMIDIHDR)dwParam1, dwParam2); - case MIDM_START: - return MIDIIn_Start(wDevID); - case MIDM_STOP: - return MIDIIn_Stop(wDevID); case MIDM_RESET: return MIDIIn_Reset(wDevID); }