winecoreaudio: Move midi_in_start and midi_in_stop to the unixlib.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-11-29 11:26:44 +00:00 committed by Alexandre Julliard
parent 15bb0e79d6
commit 05731b14d3
2 changed files with 33 additions and 28 deletions

View File

@ -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;

View File

@ -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);
}