Commit a8c252a6 authored by Jörg Höhle's avatar Jörg Höhle Committed by Alexandre Julliard

mciseq: MCI Set Port allows to select the MIDI device.

parent 33d1e593
......@@ -62,6 +62,7 @@ typedef struct tagWINE_MCIMIDI {
UINT wDevID; /* the MCI one */
HMIDI hMidi;
int nUseCount; /* Incremented for each shared open */
WORD wPort; /* the WINMM device unit */
WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
HANDLE hCallback; /* Callback handle for pending notification */
HMMIO hFile; /* mmio file handle open as Element */
......@@ -726,6 +727,7 @@ static DWORD MIDI_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSW lpParms)
wmm->hFile = 0;
wmm->hMidi = 0;
wmm->wPort = MIDI_MAPPER;
wmm->lpstrElementName = NULL;
dwDeviceID = lpParms->wDeviceID;
......@@ -962,8 +964,8 @@ static DWORD MIDI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
MIDI_mciReadNextEvent(wmm, mmt); /* FIXME == 0 */
}
dwRet = midiOutOpen((LPHMIDIOUT)&wmm->hMidi, MIDIMAPPER, 0L, 0L, CALLBACK_NULL);
/* dwRet = midiInOpen(&wmm->hMidi, MIDIMAPPER, 0L, 0L, CALLBACK_NULL);*/
dwRet = midiOutOpen((LPHMIDIOUT)&wmm->hMidi, wmm->wPort, 0L, 0L, CALLBACK_NULL);
/* dwRet = midiInOpen(&wmm->hMidi, wmm->wPort, 0L, 0L, CALLBACK_NULL);*/
if (dwRet != MMSYSERR_NOERROR) {
return dwRet;
}
......@@ -1290,7 +1292,7 @@ static DWORD MIDI_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
/**************************************************************************
* MIDI_mciSet [internal]
*/
static DWORD MIDI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
static DWORD MIDI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SEQ_SET_PARMS lpParms)
{
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
......@@ -1359,8 +1361,15 @@ static DWORD MIDI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
TRACE("MCI_SEQ_SET_SLAVE !\n");
if (dwFlags & MCI_SEQ_SET_OFFSET)
TRACE("MCI_SEQ_SET_OFFSET !\n");
if (dwFlags & MCI_SEQ_SET_PORT)
TRACE("MCI_SEQ_SET_PORT !\n");
if (dwFlags & MCI_SEQ_SET_PORT) {
TRACE("MCI_SEQ_SET_PORT = %d\n", lpParms->dwPort);
if ((UINT16)lpParms->dwPort != (UINT16)MIDI_MAPPER &&
(UINT16)lpParms->dwPort >= midiOutGetNumDevs())
/* FIXME: input/output port distinction? */
return MCIERR_SEQ_PORT_NONEXISTENT;
/* FIXME: Native manages to swap the device while playing! */
wmm->wPort = lpParms->dwPort;
}
if (dwFlags & MCI_SEQ_SET_TEMPO)
TRACE("MCI_SEQ_SET_TEMPO !\n");
return 0;
......@@ -1459,8 +1468,13 @@ static DWORD MIDI_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpPar
lpParms->dwReturn = 0;
break;
case MCI_SEQ_STATUS_PORT:
TRACE("MCI_SEQ_STATUS_PORT (%u)!\n", wmm->wDevID);
lpParms->dwReturn = MIDI_MAPPER;
if (wmm->wPort != (UINT16)MIDI_MAPPER)
lpParms->dwReturn = wmm->wPort;
else {
lpParms->dwReturn = MAKEMCIRESOURCE(MIDI_MAPPER, MCI_SEQ_MAPPER_S);
ret = MCI_RESOURCE_RETURNED;
}
TRACE("MCI_SEQ_STATUS_PORT (%u) => %d\n", wmm->wDevID, wmm->wPort);
break;
case MCI_SEQ_STATUS_TEMPO:
TRACE("MCI_SEQ_STATUS_TEMPO !\n");
......@@ -1664,7 +1678,7 @@ LRESULT CALLBACK MCIMIDI_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
case MCI_PLAY: return MIDI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
case MCI_RECORD: return MIDI_mciRecord (dwDevID, dwParam1, (LPMCI_RECORD_PARMS) dwParam2);
case MCI_STOP: return MIDI_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_SET: return MIDI_mciSet (dwDevID, dwParam1, (LPMCI_SET_PARMS) dwParam2);
case MCI_SET: return MIDI_mciSet (dwDevID, dwParam1, (LPMCI_SEQ_SET_PARMS) dwParam2);
case MCI_PAUSE: return MIDI_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_RESUME: return MIDI_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_STATUS: return MIDI_mciStatus (dwDevID, dwParam1, (LPMCI_STATUS_PARMS) dwParam2);
......
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