winmm: Move the 16bit management of midi stream (for midi out driver type) to the new 16=>32 thunking scheme.

This commit is contained in:
Eric Pouech 2009-10-22 22:10:12 +02:00 committed by Alexandre Julliard
parent 80b079e011
commit 2d235de320
4 changed files with 35 additions and 27 deletions

View File

@ -762,6 +762,11 @@ static void MMSYSTDRV_MidiOut_MapCB(UINT uMsg, DWORD_PTR* dwUser, DWORD_PTR* dw
mh16->dwOffset = mh32->dwOffset; mh16->dwOffset = mh32->dwOffset;
} }
break; break;
case MOM_POSITIONCB:
FIXME("NIY\n");
/* FIXME: would require to recreate a 16bit MIDIHDR here */
*dwParam1 = *dwParam2 = 0;
break;
default: default:
ERR("Unknown msg %u\n", uMsg); ERR("Unknown msg %u\n", uMsg);
} }

View File

@ -946,7 +946,10 @@ DWORD WINAPI midiInMessage16(HMIDIIN16 hMidiIn, UINT16 uMessage,
*/ */
MMRESULT16 WINAPI midiStreamClose16(HMIDISTRM16 hMidiStrm) MMRESULT16 WINAPI midiStreamClose16(HMIDISTRM16 hMidiStrm)
{ {
return midiStreamClose(HMIDISTRM_32(hMidiStrm)); UINT ret = midiStreamClose(HMIDISTRM_32(hMidiStrm));
if (ret == MMSYSERR_NOERROR)
MMSYSTDRV_CloseHandle((void*)HMIDISTRM_32(hMidiStrm));
return ret;
} }
/************************************************************************** /**************************************************************************
@ -956,17 +959,31 @@ MMRESULT16 WINAPI midiStreamOpen16(HMIDISTRM16* phMidiStrm, LPUINT16 devid,
DWORD cMidi, DWORD dwCallback, DWORD cMidi, DWORD dwCallback,
DWORD dwInstance, DWORD fdwOpen) DWORD dwInstance, DWORD fdwOpen)
{ {
HMIDISTRM hMidiStrm32; HMIDISTRM hMidiStrm32;
MMRESULT ret; MMRESULT ret;
UINT devid32; UINT devid32;
struct mmsystdrv_thunk* thunk;
if (!phMidiStrm || !devid) if (!phMidiStrm || !devid)
return MMSYSERR_INVALPARAM; return MMSYSERR_INVALPARAM;
devid32 = *devid; devid32 = *devid;
ret = MIDI_StreamOpen(&hMidiStrm32, &devid32, cMidi, dwCallback,
dwInstance, fdwOpen, FALSE); if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, MMSYSTDRV_MIDIOUT)))
*phMidiStrm = HMIDISTRM_16(hMidiStrm32); {
*devid = devid32; return MMSYSERR_NOMEM;
}
if ((fdwOpen & CALLBACK_TYPEMASK) == CALLBACK_FUNCTION)
{
dwCallback = (DWORD)thunk;
}
ret = midiStreamOpen(&hMidiStrm32, &devid32, cMidi, dwCallback, dwInstance, fdwOpen);
if (ret == MMSYSERR_NOERROR)
{
*phMidiStrm = HMIDISTRM_16(hMidiStrm32);
*devid = devid32;
MMSYSTDRV_SetHandle(thunk, hMidiStrm32);
}
else MMSYSTDRV_DeleteThunk(thunk);
return ret; return ret;
} }

View File

@ -203,9 +203,6 @@ LPSTR MCI_strdupWtoA(LPCWSTR str);
BOOL WINMM_CheckForMMSystem(void); BOOL WINMM_CheckForMMSystem(void);
const char* WINMM_ErrorToString(MMRESULT error); const char* WINMM_ErrorToString(MMRESULT error);
MMRESULT MIDI_StreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID,
DWORD cMidi, DWORD_PTR dwCallback,
DWORD_PTR dwInstance, DWORD fdwOpen, BOOL bFrom32);
UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType, UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType,
LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback, LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback,
DWORD_PTR dwInstance, DWORD dwFlags, BOOL bFrom32); DWORD_PTR dwInstance, DWORD dwFlags, BOOL bFrom32);

View File

@ -1780,11 +1780,11 @@ MMRESULT WINAPI midiStreamClose(HMIDISTRM hMidiStrm)
} }
/************************************************************************** /**************************************************************************
* MMSYSTEM_MidiStream_Open [internal] * midiStreamOpen [WINMM.@]
*/ */
MMRESULT MIDI_StreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID, DWORD cMidi, MMRESULT WINAPI midiStreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID,
DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen, DWORD cMidi, DWORD_PTR dwCallback,
BOOL bFrom32) DWORD_PTR dwInstance, DWORD fdwOpen)
{ {
WINE_MIDIStream* lpMidiStrm; WINE_MIDIStream* lpMidiStrm;
MMRESULT ret; MMRESULT ret;
@ -1809,7 +1809,7 @@ MMRESULT MIDI_StreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID, DWORD cMidi
mosm.dwStreamID = (DWORD)lpMidiStrm; mosm.dwStreamID = (DWORD)lpMidiStrm;
/* FIXME: the correct value is not allocated yet for MAPPER */ /* FIXME: the correct value is not allocated yet for MAPPER */
mosm.wDeviceID = *lpuDeviceID; mosm.wDeviceID = *lpuDeviceID;
lpwm = MIDI_OutAlloc(&hMidiOut, &dwCallback, &dwInstance, &fdwOpen, 1, &mosm, bFrom32); lpwm = MIDI_OutAlloc(&hMidiOut, &dwCallback, &dwInstance, &fdwOpen, 1, &mosm, TRUE);
lpMidiStrm->hDevice = hMidiOut; lpMidiStrm->hDevice = hMidiOut;
if (lphMidiStrm) if (lphMidiStrm)
*lphMidiStrm = (HMIDISTRM)hMidiOut; *lphMidiStrm = (HMIDISTRM)hMidiOut;
@ -1847,17 +1847,6 @@ MMRESULT MIDI_StreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID, DWORD cMidi
return ret; return ret;
} }
/**************************************************************************
* midiStreamOpen [WINMM.@]
*/
MMRESULT WINAPI midiStreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID,
DWORD cMidi, DWORD_PTR dwCallback,
DWORD_PTR dwInstance, DWORD fdwOpen)
{
return MIDI_StreamOpen(lphMidiStrm, lpuDeviceID, cMidi, dwCallback,
dwInstance, fdwOpen, TRUE);
}
/************************************************************************** /**************************************************************************
* midiStreamOut [WINMM.@] * midiStreamOut [WINMM.@]
*/ */