Commit 0d5c65fe authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winmm: Reduce in MMSystem the calls to WinMM's internals.

parent 5b8b9d6d
...@@ -209,7 +209,7 @@ void WINAPI OutputDebugStr16(LPCSTR str) ...@@ -209,7 +209,7 @@ void WINAPI OutputDebugStr16(LPCSTR str)
*/ */
UINT16 WINAPI mixerGetNumDevs16(void) UINT16 WINAPI mixerGetNumDevs16(void)
{ {
return MMDRV_GetNum(MMDRV_MIXER); return mixerGetNumDevs();
} }
/************************************************************************** /**************************************************************************
...@@ -443,7 +443,7 @@ DWORD WINAPI mixerMessage16(HMIXER16 hmix, UINT16 uMsg, DWORD dwParam1, ...@@ -443,7 +443,7 @@ DWORD WINAPI mixerMessage16(HMIXER16 hmix, UINT16 uMsg, DWORD dwParam1,
*/ */
UINT16 WINAPI auxGetNumDevs16(void) UINT16 WINAPI auxGetNumDevs16(void)
{ {
return MMDRV_GetNum(MMDRV_AUX); return auxGetNumDevs();
} }
/* ################################################### /* ###################################################
...@@ -480,13 +480,7 @@ UINT16 WINAPI auxGetDevCaps16(UINT16 uDeviceID, LPAUXCAPS16 lpCaps, UINT16 uSize ...@@ -480,13 +480,7 @@ UINT16 WINAPI auxGetDevCaps16(UINT16 uDeviceID, LPAUXCAPS16 lpCaps, UINT16 uSize
*/ */
UINT16 WINAPI auxGetVolume16(UINT16 uDeviceID, LPDWORD lpdwVolume) UINT16 WINAPI auxGetVolume16(UINT16 uDeviceID, LPDWORD lpdwVolume)
{ {
LPWINE_MLD wmld; return auxGetVolume(uDeviceID, lpdwVolume);
TRACE("(%04X, %p) !\n", uDeviceID, lpdwVolume);
if ((wmld = MMDRV_Get((HANDLE)(ULONG_PTR)uDeviceID, MMDRV_AUX, TRUE)) == NULL)
return MMSYSERR_INVALHANDLE;
return MMDRV_Message(wmld, AUXDM_GETVOLUME, (DWORD_PTR)lpdwVolume, 0L, TRUE);
} }
/************************************************************************** /**************************************************************************
...@@ -494,13 +488,7 @@ UINT16 WINAPI auxGetVolume16(UINT16 uDeviceID, LPDWORD lpdwVolume) ...@@ -494,13 +488,7 @@ UINT16 WINAPI auxGetVolume16(UINT16 uDeviceID, LPDWORD lpdwVolume)
*/ */
UINT16 WINAPI auxSetVolume16(UINT16 uDeviceID, DWORD dwVolume) UINT16 WINAPI auxSetVolume16(UINT16 uDeviceID, DWORD dwVolume)
{ {
LPWINE_MLD wmld; return auxSetVolume(uDeviceID, dwVolume);
TRACE("(%04X, %u) !\n", uDeviceID, dwVolume);
if ((wmld = MMDRV_Get((HANDLE)(ULONG_PTR)uDeviceID, MMDRV_AUX, TRUE)) == NULL)
return MMSYSERR_INVALHANDLE;
return MMDRV_Message(wmld, AUXDM_SETVOLUME, dwVolume, 0L, TRUE);
} }
/************************************************************************** /**************************************************************************
...@@ -508,8 +496,6 @@ UINT16 WINAPI auxSetVolume16(UINT16 uDeviceID, DWORD dwVolume) ...@@ -508,8 +496,6 @@ UINT16 WINAPI auxSetVolume16(UINT16 uDeviceID, DWORD dwVolume)
*/ */
DWORD WINAPI auxOutMessage16(UINT16 uDeviceID, UINT16 uMessage, DWORD dw1, DWORD dw2) DWORD WINAPI auxOutMessage16(UINT16 uDeviceID, UINT16 uMessage, DWORD dw1, DWORD dw2)
{ {
LPWINE_MLD wmld;
TRACE("(%04X, %04X, %08X, %08X)\n", uDeviceID, uMessage, dw1, dw2); TRACE("(%04X, %04X, %08X, %08X)\n", uDeviceID, uMessage, dw1, dw2);
switch (uMessage) { switch (uMessage) {
...@@ -526,10 +512,7 @@ DWORD WINAPI auxOutMessage16(UINT16 uDeviceID, UINT16 uMessage, DWORD dw1, DWORD ...@@ -526,10 +512,7 @@ DWORD WINAPI auxOutMessage16(UINT16 uDeviceID, UINT16 uMessage, DWORD dw1, DWORD
uDeviceID, uMessage, dw1, dw2); uDeviceID, uMessage, dw1, dw2);
break; break;
} }
if ((wmld = MMDRV_Get((HANDLE)(ULONG_PTR)uDeviceID, MMDRV_AUX, TRUE)) == NULL) return auxOutMessage(uDeviceID, uMessage, dw1, dw2);
return MMSYSERR_INVALHANDLE;
return MMDRV_Message(wmld, uMessage, dw1, dw2, TRUE);
} }
/* ################################################### /* ###################################################
...@@ -657,14 +640,7 @@ YIELDPROC16 WINAPI mciGetYieldProc16(UINT16 uDeviceID, DWORD* lpdwYieldData) ...@@ -657,14 +640,7 @@ YIELDPROC16 WINAPI mciGetYieldProc16(UINT16 uDeviceID, DWORD* lpdwYieldData)
*/ */
HTASK16 WINAPI mciGetCreatorTask16(UINT16 uDeviceID) HTASK16 WINAPI mciGetCreatorTask16(UINT16 uDeviceID)
{ {
LPWINE_MCIDRIVER wmd; return HTASK_16(mciGetCreatorTask(uDeviceID));
HTASK16 ret = 0;
if ((wmd = MCI_GetDriver(uDeviceID)))
ret = HTASK_16(wmd->CreatorThread);
TRACE("(%u) => %04x\n", uDeviceID, ret);
return ret;
} }
/************************************************************************** /**************************************************************************
...@@ -696,7 +672,7 @@ UINT16 WINAPI mciDriverYield16(UINT16 uDeviceID) ...@@ -696,7 +672,7 @@ UINT16 WINAPI mciDriverYield16(UINT16 uDeviceID)
*/ */
UINT16 WINAPI midiOutGetNumDevs16(void) UINT16 WINAPI midiOutGetNumDevs16(void)
{ {
return MMDRV_GetNum(MMDRV_MIDIOUT); return midiOutGetNumDevs();
} }
/************************************************************************** /**************************************************************************
...@@ -871,16 +847,13 @@ UINT16 WINAPI midiOutCacheDrumPatches16(HMIDIOUT16 hMidiOut, UINT16 uPatch, ...@@ -871,16 +847,13 @@ UINT16 WINAPI midiOutCacheDrumPatches16(HMIDIOUT16 hMidiOut, UINT16 uPatch,
*/ */
UINT16 WINAPI midiOutGetID16(HMIDIOUT16 hMidiOut, UINT16* lpuDeviceID) UINT16 WINAPI midiOutGetID16(HMIDIOUT16 hMidiOut, UINT16* lpuDeviceID)
{ {
LPWINE_MLD wmld; UINT devid;
UINT16 ret;
TRACE("(%04X, %p)\n", hMidiOut, lpuDeviceID);
if (lpuDeviceID == NULL) return MMSYSERR_INVALPARAM;
if ((wmld = MMDRV_Get(HMIDIOUT_32(hMidiOut), MMDRV_MIDIOUT, FALSE)) == NULL)
return MMSYSERR_INVALHANDLE;
*lpuDeviceID = wmld->uDeviceID; ret = midiOutGetID(HMIDIOUT_32(hMidiOut), &devid);
return MMSYSERR_NOERROR; if (ret != MMSYSERR_NOERROR) return ret;
*lpuDeviceID = devid;
return ret;
} }
/************************************************************************** /**************************************************************************
...@@ -920,7 +893,7 @@ DWORD WINAPI midiOutMessage16(HMIDIOUT16 hMidiOut, UINT16 uMessage, ...@@ -920,7 +893,7 @@ DWORD WINAPI midiOutMessage16(HMIDIOUT16 hMidiOut, UINT16 uMessage,
*/ */
UINT16 WINAPI midiInGetNumDevs16(void) UINT16 WINAPI midiInGetNumDevs16(void)
{ {
return MMDRV_GetNum(MMDRV_MIDIIN); return midiInGetNumDevs();
} }
/************************************************************************** /**************************************************************************
...@@ -1055,18 +1028,13 @@ UINT16 WINAPI midiInReset16(HMIDIIN16 hMidiIn) ...@@ -1055,18 +1028,13 @@ UINT16 WINAPI midiInReset16(HMIDIIN16 hMidiIn)
*/ */
UINT16 WINAPI midiInGetID16(HMIDIIN16 hMidiIn, UINT16* lpuDeviceID) UINT16 WINAPI midiInGetID16(HMIDIIN16 hMidiIn, UINT16* lpuDeviceID)
{ {
LPWINE_MLD wmld; UINT devid;
UINT16 ret;
TRACE("(%04X, %p)\n", hMidiIn, lpuDeviceID);
if (lpuDeviceID == NULL) return MMSYSERR_INVALPARAM; ret = midiInGetID(HMIDIIN_32(hMidiIn), &devid);
if (ret != MMSYSERR_NOERROR) return ret;
if ((wmld = MMDRV_Get(HMIDIIN_32(hMidiIn), MMDRV_MIDIIN, TRUE)) == NULL) *lpuDeviceID = devid;
return MMSYSERR_INVALHANDLE; return ret;
*lpuDeviceID = wmld->uDeviceID;
return MMSYSERR_NOERROR;
} }
/************************************************************************** /**************************************************************************
...@@ -1197,7 +1165,7 @@ MMRESULT16 WINAPI midiStreamStop16(HMIDISTRM16 hMidiStrm) ...@@ -1197,7 +1165,7 @@ MMRESULT16 WINAPI midiStreamStop16(HMIDISTRM16 hMidiStrm)
*/ */
UINT16 WINAPI waveOutGetNumDevs16(void) UINT16 WINAPI waveOutGetNumDevs16(void)
{ {
return MMDRV_GetNum(MMDRV_WAVEOUT); return waveOutGetNumDevs();
} }
/************************************************************************** /**************************************************************************
...@@ -1466,17 +1434,13 @@ UINT16 WINAPI waveOutSetVolume16(UINT16 devid, DWORD dw) ...@@ -1466,17 +1434,13 @@ UINT16 WINAPI waveOutSetVolume16(UINT16 devid, DWORD dw)
*/ */
UINT16 WINAPI waveOutGetID16(HWAVEOUT16 hWaveOut, UINT16* lpuDeviceID) UINT16 WINAPI waveOutGetID16(HWAVEOUT16 hWaveOut, UINT16* lpuDeviceID)
{ {
LPWINE_MLD wmld; UINT devid;
UINT16 ret;
TRACE("(%04X, %p);\n", hWaveOut, lpuDeviceID);
if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
if ((wmld = MMDRV_Get(HWAVEOUT_32(hWaveOut), MMDRV_WAVEOUT, FALSE)) == NULL)
return MMSYSERR_INVALHANDLE;
*lpuDeviceID = wmld->uDeviceID; ret = waveOutGetID(HWAVEOUT_32(hWaveOut), &devid);
return 0; if (ret != MMSYSERR_NOERROR) return ret;
*lpuDeviceID = devid;
return ret;
} }
/************************************************************************** /**************************************************************************
...@@ -1510,7 +1474,7 @@ DWORD WINAPI waveOutMessage16(HWAVEOUT16 hWaveOut, UINT16 uMessage, ...@@ -1510,7 +1474,7 @@ DWORD WINAPI waveOutMessage16(HWAVEOUT16 hWaveOut, UINT16 uMessage,
*/ */
UINT16 WINAPI waveInGetNumDevs16(void) UINT16 WINAPI waveInGetNumDevs16(void)
{ {
return MMDRV_GetNum(MMDRV_WAVEIN); return waveInGetNumDevs();
} }
/************************************************************************** /**************************************************************************
...@@ -1701,17 +1665,13 @@ UINT16 WINAPI waveInGetPosition16(HWAVEIN16 hWaveIn, LPMMTIME16 lpTime, ...@@ -1701,17 +1665,13 @@ UINT16 WINAPI waveInGetPosition16(HWAVEIN16 hWaveIn, LPMMTIME16 lpTime,
*/ */
UINT16 WINAPI waveInGetID16(HWAVEIN16 hWaveIn, UINT16* lpuDeviceID) UINT16 WINAPI waveInGetID16(HWAVEIN16 hWaveIn, UINT16* lpuDeviceID)
{ {
LPWINE_MLD wmld; UINT devid;
UINT16 ret;
TRACE("(%04X, %p);\n", hWaveIn, lpuDeviceID);
if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
if ((wmld = MMDRV_Get(HWAVEIN_32(hWaveIn), MMDRV_WAVEIN, FALSE)) == NULL) ret = waveInGetID(HWAVEIN_32(hWaveIn), &devid);
return MMSYSERR_INVALHANDLE; if (ret != MMSYSERR_NOERROR) return ret;
*lpuDeviceID = devid;
*lpuDeviceID = wmld->uDeviceID; return ret;
return MMSYSERR_NOERROR;
} }
/************************************************************************** /**************************************************************************
......
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