/************************************************************************** * midiOutMessage [WINMM.@] */ UINT WINAPI midiOutMessage(HMIDIOUT hMidiOut, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { LPWINE_MLD wmld; TRACE("(%p, %04X, %08lX, %08lX)\n", hMidiOut, uMessage, dwParam1, dwParam2); if ((wmld = MMDRV_Get(hMidiOut, MMDRV_MIDIOUT, FALSE)) == NULL) { /* HACK... */ if (uMessage == 0x0001) { *(LPDWORD)dwParam1 = 1; return 0; } if ((wmld = MMDRV_Get(hMidiOut, MMDRV_MIDIOUT, TRUE)) != NULL) { return MMDRV_PhysicalFeatures(wmld, uMessage, dwParam1, dwParam2); } return MMSYSERR_INVALHANDLE; } switch (uMessage) { case MODM_OPEN: case MODM_CLOSE: FIXME("can't handle OPEN or CLOSE message!\n"); return MMSYSERR_NOTSUPPORTED; } return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2); }
/************************************************************************** * auxOutMessage [WINMM.@] */ UINT WINAPI auxOutMessage(UINT uDeviceID, UINT uMessage, DWORD_PTR dw1, DWORD_PTR dw2) { LPWINE_MLD wmld; if ((wmld = MMDRV_Get((HANDLE)(DWORD_PTR)uDeviceID, MMDRV_AUX, TRUE)) == NULL) return MMSYSERR_INVALHANDLE; return MMDRV_Message(wmld, uMessage, dw1, dw2); }
/************************************************************************** * auxSetVolume [WINMM.@] */ UINT WINAPI auxSetVolume(UINT uDeviceID, DWORD dwVolume) { LPWINE_MLD wmld; TRACE("(%04X, %u) !\n", uDeviceID, dwVolume); if ((wmld = MMDRV_Get((HANDLE)(DWORD_PTR)uDeviceID, MMDRV_AUX, TRUE)) == NULL) return MMSYSERR_INVALHANDLE; return MMDRV_Message(wmld, AUXDM_SETVOLUME, dwVolume, 0L); }
/************************************************************************** * midiOutSetVolume [WINMM.@] */ UINT WINAPI midiOutSetVolume(HMIDIOUT hMidiOut, DWORD dwVolume) { LPWINE_MLD wmld; TRACE("(%p, %d);\n", hMidiOut, dwVolume); if ((wmld = MMDRV_Get(hMidiOut, MMDRV_MIDIOUT, TRUE)) == NULL) return MMSYSERR_INVALHANDLE; return MMDRV_Message(wmld, MODM_SETVOLUME, dwVolume, 0L); }
/************************************************************************** * midiOutShortMsg [WINMM.@] */ UINT WINAPI midiOutShortMsg(HMIDIOUT hMidiOut, DWORD dwMsg) { LPWINE_MLD wmld; TRACE("(%p, %08X)\n", hMidiOut, dwMsg); if ((wmld = MMDRV_Get(hMidiOut, MMDRV_MIDIOUT, FALSE)) == NULL) return MMSYSERR_INVALHANDLE; return MMDRV_Message(wmld, MODM_DATA, dwMsg, 0L); }
/************************************************************************** * midiInReset [WINMM.@] */ UINT WINAPI midiInReset(HMIDIIN hMidiIn) { LPWINE_MLD wmld; TRACE("(%p)\n", hMidiIn); if ((wmld = MMDRV_Get(hMidiIn, MMDRV_MIDIIN, FALSE)) == NULL) return MMSYSERR_INVALHANDLE; return MMDRV_Message(wmld, MIDM_RESET, 0L, 0L); }
/************************************************************************** * midiOutReset [WINMM.@] */ UINT WINAPI midiOutReset(HMIDIOUT hMidiOut) { LPWINE_MLD wmld; TRACE("(%p)\n", hMidiOut); if ((wmld = MMDRV_Get(hMidiOut, MMDRV_MIDIOUT, FALSE)) == NULL) return MMSYSERR_INVALHANDLE; return MMDRV_Message(wmld, MODM_RESET, 0L, 0L); }
/************************************************************************** * MMDRV_Open [internal] */ DWORD MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD dwParam1, DWORD dwFlags) { DWORD dwRet = MMSYSERR_BADDEVICEID; DWORD dwInstance; WINE_LLTYPE* llType = &llTypes[mld->type]; TRACE("(%p, %04x, 0x%08x, 0x%08x)\n", mld, wMsg, dwParam1, dwFlags); mld->dwDriverInstance = (DWORD)&dwInstance; if (mld->uDeviceID == (UINT)-1 || mld->uDeviceID == (UINT16)-1) { TRACE("MAPPER mode requested !\n"); /* check if mapper is supported by type */ if (llType->bSupportMapper) { if (llType->nMapper == -1) { /* no driver for mapper has been loaded, try a dumb implementation */ TRACE("No mapper loaded, doing it by hand\n"); for (mld->uDeviceID = 0; mld->uDeviceID < llType->wMaxId; mld->uDeviceID++) { if ((dwRet = MMDRV_Open(mld, wMsg, dwParam1, dwFlags)) == MMSYSERR_NOERROR) { /* to share this function epilog */ dwInstance = mld->dwDriverInstance; break; } } } else { mld->uDeviceID = (UINT16)-1; mld->mmdIndex = llType->lpMlds[-1].mmdIndex; TRACE("Setting mmdIndex to %u\n", mld->mmdIndex); dwRet = MMDRV_Message(mld, wMsg, dwParam1, dwFlags, TRUE); } } } else { if (mld->uDeviceID < llType->wMaxId) { mld->mmdIndex = llType->lpMlds[mld->uDeviceID].mmdIndex; TRACE("Setting mmdIndex to %u\n", mld->mmdIndex); dwRet = MMDRV_Message(mld, wMsg, dwParam1, dwFlags, TRUE); } } if (dwRet == MMSYSERR_NOERROR) mld->dwDriverInstance = dwInstance; return dwRet; }
/************************************************************************** * auxGetDevCapsW [WINMM.@] */ UINT WINAPI auxGetDevCapsW(UINT_PTR uDeviceID, LPAUXCAPSW lpCaps, UINT uSize) { LPWINE_MLD wmld; TRACE("(%04lX, %p, %d) !\n", uDeviceID, lpCaps, uSize); if (lpCaps == NULL) return MMSYSERR_INVALPARAM; if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_AUX, TRUE)) == NULL) return MMSYSERR_BADDEVICEID; return MMDRV_Message(wmld, AUXDM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize); }
/************************************************************************** * midiOutLongMsg [WINMM.@] */ UINT WINAPI midiOutLongMsg(HMIDIOUT hMidiOut, MIDIHDR* lpMidiOutHdr, UINT uSize) { LPWINE_MLD wmld; TRACE("(%p, %p, %d)\n", hMidiOut, lpMidiOutHdr, uSize); if ((wmld = MMDRV_Get(hMidiOut, MMDRV_MIDIOUT, FALSE)) == NULL) return MMSYSERR_INVALHANDLE; return MMDRV_Message(wmld, MODM_LONGDATA, (DWORD_PTR)lpMidiOutHdr, uSize); }
/************************************************************************** * midiInAddBuffer [WINMM.@] */ UINT WINAPI midiInAddBuffer(HMIDIIN hMidiIn, MIDIHDR* lpMidiInHdr, UINT uSize) { LPWINE_MLD wmld; TRACE("(%p, %p, %d)\n", hMidiIn, lpMidiInHdr, uSize); if ((wmld = MMDRV_Get(hMidiIn, MMDRV_MIDIIN, FALSE)) == NULL) return MMSYSERR_INVALHANDLE; return MMDRV_Message(wmld, MIDM_ADDBUFFER, (DWORD_PTR)lpMidiInHdr, uSize); }
/************************************************************************** * midiInGetDevCapsW [WINMM.@] */ UINT WINAPI midiInGetDevCapsW(UINT_PTR uDeviceID, LPMIDIINCAPSW lpCaps, UINT uSize) { LPWINE_MLD wmld; TRACE("(%ld, %p, %d);\n", uDeviceID, lpCaps, uSize); if (lpCaps == NULL) return MMSYSERR_INVALPARAM; if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_MIDIIN, TRUE)) == NULL) return MMSYSERR_BADDEVICEID; return MMDRV_Message(wmld, MIDM_GETDEVCAPS, (DWORD_PTR)lpCaps, uSize); }
/************************************************************************** * midiInPrepareHeader [WINMM.@] */ UINT WINAPI midiInPrepareHeader(HMIDIIN hMidiIn, MIDIHDR* lpMidiInHdr, UINT uSize) { LPWINE_MLD wmld; TRACE("(%p, %p, %d)\n", hMidiIn, lpMidiInHdr, uSize); if (lpMidiInHdr == NULL || uSize < offsetof(MIDIHDR,dwOffset)) return MMSYSERR_INVALPARAM; if ((wmld = MMDRV_Get(hMidiIn, MMDRV_MIDIIN, FALSE)) == NULL) return MMSYSERR_INVALHANDLE; return MMDRV_Message(wmld, MIDM_PREPARE, (DWORD_PTR)lpMidiInHdr, uSize); }
/************************************************************************** * midiOutPrepareHeader [WINMM.@] */ UINT WINAPI midiOutPrepareHeader(HMIDIOUT hMidiOut, MIDIHDR* lpMidiOutHdr, UINT uSize) { LPWINE_MLD wmld; TRACE("(%p, %p, %d)\n", hMidiOut, lpMidiOutHdr, uSize); if (lpMidiOutHdr == NULL || uSize < offsetof(MIDIHDR,dwOffset)) return MMSYSERR_INVALPARAM; if ((wmld = MMDRV_Get(hMidiOut, MMDRV_MIDIOUT, FALSE)) == NULL) return MMSYSERR_INVALHANDLE; /* FIXME: detect MIDIStream handles and enforce 64KB buffer limit on those */ return MMDRV_Message(wmld, MODM_PREPARE, (DWORD_PTR)lpMidiOutHdr, uSize); }
/************************************************************************** * midiInMessage [WINMM.@] */ UINT WINAPI midiInMessage(HMIDIIN hMidiIn, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { LPWINE_MLD wmld; TRACE("(%p, %04X, %08lX, %08lX)\n", hMidiIn, uMessage, dwParam1, dwParam2); if ((wmld = MMDRV_Get(hMidiIn, MMDRV_MIDIIN, FALSE)) == NULL) return MMSYSERR_INVALHANDLE; switch (uMessage) { case MIDM_OPEN: case MIDM_CLOSE: FIXME("can't handle OPEN or CLOSE message!\n"); return MMSYSERR_NOTSUPPORTED; } return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2); }
/************************************************************************** * midiOutUnprepareHeader [WINMM.@] */ UINT WINAPI midiOutUnprepareHeader(HMIDIOUT hMidiOut, MIDIHDR* lpMidiOutHdr, UINT uSize) { LPWINE_MLD wmld; TRACE("(%p, %p, %d)\n", hMidiOut, lpMidiOutHdr, uSize); if (lpMidiOutHdr == NULL || uSize < offsetof(MIDIHDR,dwOffset)) return MMSYSERR_INVALPARAM; if (!(lpMidiOutHdr->dwFlags & MHDR_PREPARED)) { return MMSYSERR_NOERROR; } if ((wmld = MMDRV_Get(hMidiOut, MMDRV_MIDIOUT, FALSE)) == NULL) return MMSYSERR_INVALHANDLE; return MMDRV_Message(wmld, MODM_UNPREPARE, (DWORD_PTR)lpMidiOutHdr, uSize); }
/************************************************************************** * MMDRV_Close [internal] */ DWORD MMDRV_Close(LPWINE_MLD mld, UINT wMsg) { TRACE("(%p, %04x)\n", mld, wMsg); return MMDRV_Message(mld, wMsg, 0L, 0L, TRUE); }