1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
3 /*****************************************************************************
4 * Copyright 1998, Luiz Otavio L. Zorzella
7 * Purpose: multimedia declarations (internal to WINMM & MMSYSTEM DLLs)
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *****************************************************************************
28 typedef DWORD (WINAPI
*MessageProc16
)(UINT16 wDevID
, UINT16 wMsg
, DWORD dwUser
, DWORD dwParam1
, DWORD dwParam2
);
29 typedef DWORD (WINAPI
*MessageProc32
)(UINT wDevID
, UINT wMsg
, DWORD dwUser
, DWORD dwParam1
, DWORD dwParam2
);
32 WINMM_MAP_NOMEM
, /* ko, memory problem */
33 WINMM_MAP_MSGERROR
, /* ko, unknown message */
34 WINMM_MAP_OK
, /* ok, no memory allocated. to be sent to the proc. */
35 WINMM_MAP_OKMEM
, /* ok, some memory allocated, need to call UnMapMsg. to be sent to the proc. */
38 /* Who said goofy boy ? */
39 #define WINE_DI_MAGIC 0x900F1B01
41 typedef struct tagWINE_DRIVER
44 /* as usual LPWINE_DRIVER == hDriver32 */
56 struct tagWINE_DRIVER
* lpPrevItem
;
57 struct tagWINE_DRIVER
* lpNextItem
;
58 } WINE_DRIVER
, *LPWINE_DRIVER
;
60 typedef struct tagWINE_MLD
{
61 /* EPP struct tagWINE_MLD* lpNext; */ /* not used so far */
64 UINT mmdIndex
; /* index to low-level driver in MMDrvs table */
65 DWORD dwDriverInstance
; /* this value is driver related, as opposed to
66 * opendesc.dwInstance which is client (callback) related */
70 DWORD dwClientInstance
;
71 } WINE_MLD
, *LPWINE_MLD
;
75 } WINE_WAVE
, *LPWINE_WAVE
;
79 MIDIOPENDESC mod
; /* FIXME: should be removed */
80 } WINE_MIDI
, *LPWINE_MIDI
;
84 } WINE_MIXER
, *LPWINE_MIXER
;
86 extern BOOL
MMDRV_Init(void);
87 extern UINT
MMDRV_GetNum(UINT
);
88 extern LPWINE_MLD
MMDRV_Alloc(UINT size
, UINT type
, LPHANDLE hndl
, DWORD
* dwFlags
,
89 DWORD
* dwCallback
, DWORD
* dwInstance
, BOOL bFrom32
);
90 extern void MMDRV_Free(HANDLE hndl
, LPWINE_MLD mld
);
91 extern DWORD
MMDRV_Open(LPWINE_MLD mld
, UINT wMsg
, DWORD dwParam1
, DWORD dwParam2
);
92 extern DWORD
MMDRV_Close(LPWINE_MLD mld
, UINT wMsg
);
93 extern LPWINE_MLD
MMDRV_Get(HANDLE hndl
, UINT type
, BOOL bCanBeID
);
94 extern LPWINE_MLD
MMDRV_GetRelated(HANDLE hndl
, UINT srcType
, BOOL bSrcCanBeID
, UINT dstTyped
);
95 extern DWORD
MMDRV_Message(LPWINE_MLD mld
, WORD wMsg
, DWORD dwParam1
, DWORD dwParam2
, BOOL bFrom32
);
96 extern UINT
MMDRV_PhysicalFeatures(LPWINE_MLD mld
, UINT uMsg
, DWORD dwParam1
, DWORD dwParam2
);
100 #define MMDRV_MIDIIN 2
101 #define MMDRV_MIDIOUT 3
102 #define MMDRV_WAVEIN 4
103 #define MMDRV_WAVEOUT 5
106 #define WINE_MMTHREAD_CREATED 0x4153494C /* "BSIL" */
107 #define WINE_MMTHREAD_DELETED 0xDEADDEAD
110 DWORD dwSignature
; /* 00 "BSIL" when ok, 0xDEADDEAD when being deleted */
111 DWORD dwCounter
; /* 04 > 1 when in mmThread functions */
112 HANDLE hThread
; /* 08 hThread */
113 DWORD dwThreadID
; /* 0C */
114 FARPROC16 fpThread
; /* 10 address of thread proc (segptr or lin depending on dwFlags) */
115 DWORD dwThreadPmt
; /* 14 parameter to be passed upon thread creation to fpThread */
116 DWORD dwSignalCount
; /* 18 counter used for signaling */
117 HANDLE hEvent
; /* 1C event */
118 HANDLE hVxD
; /* 20 return from OpenVxDHandle */
119 DWORD dwStatus
; /* 24 0x00, 0x10, 0x20, 0x30 */
120 DWORD dwFlags
; /* 28 dwFlags upon creation */
121 HANDLE16 hTask
; /* 2C handle to created task */
124 typedef struct tagWINE_MCIDRIVER
{
127 LPSTR lpstrElementName
;
128 LPSTR lpstrDeviceType
;
131 DRIVERPROC16 driverProc
;
133 YIELDPROC lpfnYieldProc
;
136 HTASK16 hCreatorTask
;
139 UINT uSpecificCmdTable
;
140 struct tagWINE_MCIDRIVER
*lpNext
;
141 } WINE_MCIDRIVER
, *LPWINE_MCIDRIVER
;
143 #define WINE_TIMER_IS32 0x80
145 typedef struct tagWINE_TIMERENTRY
{
153 struct tagWINE_TIMERENTRY
* lpNext
;
154 } WINE_TIMERENTRY
, *LPWINE_TIMERENTRY
;
156 enum mmioProcType
{MMIO_PROC_16
,MMIO_PROC_32A
,MMIO_PROC_32W
};
160 struct IOProcList
*pNext
; /* Next item in linked list */
161 FOURCC fourCC
; /* four-character code identifying IOProc */
162 LPMMIOPROC pIOProc
; /* pointer to IProc */
163 enum mmioProcType type
; /* 16, 32A or 32W */
164 int count
; /* number of objects linked to it */
167 typedef struct tagWINE_MMIO
{
169 struct tagWINE_MMIO
* lpNext
;
170 struct IOProcList
* ioProc
;
175 } WINE_MMIO
, *LPWINE_MMIO
;
177 typedef struct tagWINE_PLAYSOUND
{
183 struct tagWINE_PLAYSOUND
* lpNext
;
184 } WINE_PLAYSOUND
, *LPWINE_PLAYSOUND
;
186 typedef struct tagWINE_MM_IDATA
{
188 HANDLE hWinMM32Instance
;
189 HANDLE hWinMM16Instance
;
195 LPWINE_TIMERENTRY lpTimerList
;
197 LPWINE_TIMERENTRY lpTimers
;
199 LPWINE_MCIDRIVER lpMciDrvs
;
200 /* low level drivers (unused yet) */
201 /* LPWINE_WAVE lpWave; */
202 /* LPWINE_MIDI lpMidi; */
203 /* LPWINE_MIXER lpMixer; */
206 LRESULT (CALLBACK
* pFnMmioCallback16
)(SEGPTR
,LPMMIOINFO
,UINT
,LPARAM
,LPARAM
);
207 /* playsound and sndPlaySound */
208 WINE_PLAYSOUND
* lpPlaySound
;
211 } WINE_MM_IDATA
, *LPWINE_MM_IDATA
;
213 /* function prototypes */
215 typedef LONG (*MCIPROC16
)(DWORD
, HDRVR16
, WORD
, DWORD
, DWORD
);
216 typedef LONG (*MCIPROC
)(DWORD
, HDRVR
, DWORD
, DWORD
, DWORD
);
218 extern LPWINE_DRIVER
DRIVER_FindFromHDrvr(HDRVR hDrvr
);
219 extern BOOL
DRIVER_GetLibName(LPCSTR keyName
, LPCSTR sectName
, LPSTR buf
, int sz
);
220 extern LPWINE_DRIVER
DRIVER_TryOpenDriver32(LPCSTR fn
, LPARAM lParam2
);
222 extern LPWINE_MCIDRIVER
MCI_GetDriver(UINT16 uDevID
);
223 extern UINT
MCI_GetDriverFromString(LPCSTR str
);
224 extern DWORD
MCI_WriteString(LPSTR lpDstStr
, DWORD dstSize
, LPCSTR lpSrcStr
);
225 extern const char* MCI_MessageToString(UINT16 wMsg
);
227 extern UINT WINAPI
MCI_DefYieldProc(MCIDEVICEID wDevID
, DWORD data
);
229 extern LRESULT
MCI_CleanUp(LRESULT dwRet
, UINT wMsg
, DWORD dwParam2
, BOOL bIs32
);
231 extern DWORD
MCI_SendCommand(UINT wDevID
, UINT16 wMsg
, DWORD dwParam1
, DWORD dwParam2
, BOOL bFrom32
);
232 extern DWORD
MCI_SendCommandFrom32(UINT wDevID
, UINT16 wMsg
, DWORD dwParam1
, DWORD dwParam2
);
233 extern DWORD
MCI_SendCommandFrom16(UINT wDevID
, UINT16 wMsg
, DWORD dwParam1
, DWORD dwParam2
);
235 void CALLBACK
WINE_mmThreadEntryPoint(DWORD _pmt
);
237 void MMSYSTEM_MMTIME16to32(LPMMTIME mmt32
, const MMTIME16
* mmt16
);
238 void MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16
, const MMTIME
* mmt32
);
240 UINT
MMSYSTEM_mixerOpen(LPHMIXER lphMix
, UINT uDeviceID
, DWORD dwCallback
,
241 DWORD dwInstance
, DWORD fdwOpen
, BOOL bFrom32
);
242 UINT
MMSYSTEM_midiOutOpen(HMIDIOUT
* lphMidiOut
, UINT uDeviceID
, DWORD dwCallback
,
243 DWORD dwInstance
, DWORD dwFlags
, BOOL bFrom32
);
244 UINT
MMSYSTEM_midiInOpen(HMIDIIN
* lphMidiIn
, UINT uDeviceID
, DWORD dwCallback
,
245 DWORD dwInstance
, DWORD dwFlags
, BOOL bFrom32
);
246 MMRESULT
MMSYSTEM_MidiStream_Open(HMIDISTRM
* lphMidiStrm
, LPUINT lpuDeviceID
,
247 DWORD cMidi
, DWORD dwCallback
,
248 DWORD dwInstance
, DWORD fdwOpen
, BOOL bFrom32
);
249 UINT
MMSYSTEM_waveOpen(HANDLE
* lphndl
, UINT uDeviceID
, UINT uType
,
250 const LPWAVEFORMATEX lpFormat
, DWORD dwCallback
,
251 DWORD dwInstance
, DWORD dwFlags
, BOOL bFrom32
);
252 WORD
timeSetEventInternal(UINT wDelay
, UINT wResol
,
253 FARPROC16 lpFunc
, DWORD dwUser
, UINT wFlags
);
254 HMMIO
MMIO_Open(LPSTR szFileName
, MMIOINFO
* refmminfo
,
255 DWORD dwOpenFlags
, enum mmioProcType type
);
256 LPMMIOPROC
MMIO_InstallIOProc(FOURCC fccIOProc
, LPMMIOPROC pIOProc
,
257 DWORD dwFlags
, enum mmioProcType type
);
258 LRESULT
MMIO_SendMessage(HMMIO hmmio
, UINT uMessage
, LPARAM lParam1
,
259 LPARAM lParam2
, enum mmioProcType type
);
260 LPWINE_MMIO
MMIO_Get(HMMIO h
);
262 BOOL
MULTIMEDIA_MciInit(void);
263 BOOL
MULTIMEDIA_PlaySound(const void* pszSound
, HMODULE hmod
, DWORD fdwSound
, BOOL bUnicode
);
265 void TIME_MMTimeStart(void);
266 void TIME_MMTimeStop(void);
268 /* temporary defines */
269 WINMM_MapType
DRIVER_MapMsg32To16(WORD wMsg
, DWORD
* lParam1
, DWORD
* lParam2
);
270 WINMM_MapType
DRIVER_UnMapMsg32To16(WORD wMsg
, DWORD lParam1
, DWORD lParam2
);
272 /* Global variables */
273 extern LPWINE_MM_IDATA WINMM_IData
;
275 /* HANDLE16 -> HANDLE conversions */
276 #define HDRVR_32(h16) ((HDRVR)(ULONG_PTR)(h16))
277 #define HMIDI_32(h16) ((HMIDI)(ULONG_PTR)(h16))
278 #define HMIDIIN_32(h16) ((HMIDIIN)(ULONG_PTR)(h16))
279 #define HMIDIOUT_32(h16) ((HMIDIOUT)(ULONG_PTR)(h16))
280 #define HMIDISTRM_32(h16) ((HMIDISTRM)(ULONG_PTR)(h16))
281 #define HMIXER_32(h16) ((HMIXER)(ULONG_PTR)(h16))
282 #define HMIXEROBJ_32(h16) ((HMIXEROBJ)(ULONG_PTR)(h16))
283 #define HMMIO_32(h16) ((HMMIO)(ULONG_PTR)(h16))
284 #define HWAVE_32(h16) ((HWAVE)(ULONG_PTR)(h16))
285 #define HWAVEIN_32(h16) ((HWAVEIN)(ULONG_PTR)(h16))
286 #define HWAVEOUT_32(h16) ((HWAVEOUT)(ULONG_PTR)(h16))
288 /* HANDLE -> HANDLE16 conversions */
289 #define HDRVR_16(h32) (LOWORD(h32))
290 #define HMIDI_16(h32) (LOWORD(h32))
291 #define HMIDIIN_16(h32) (LOWORD(h32))
292 #define HMIDIOUT_16(h32) (LOWORD(h32))
293 #define HMIDISTRM_16(h32) (LOWORD(h32))
294 #define HMIXER_16(h32) (LOWORD(h32))
295 #define HMIXEROBJ_16(h32) (LOWORD(h32))
296 #define HMMIO_16(h32) (LOWORD(h32))
297 #define HWAVE_16(h32) (LOWORD(h32))
298 #define HWAVEIN_16(h32) (LOWORD(h32))
299 #define HWAVEOUT_16(h32) (LOWORD(h32))