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
);
31 /* Who said goofy boy ? */
32 #define WINE_DI_MAGIC 0x900F1B01
34 typedef struct tagWINE_DRIVER
37 /* as usual LPWINE_DRIVER == hDriver32 */
49 struct tagWINE_DRIVER
* lpPrevItem
;
50 struct tagWINE_DRIVER
* lpNextItem
;
51 } WINE_DRIVER
, *LPWINE_DRIVER
;
53 typedef struct tagWINE_MLD
{
54 /* EPP struct tagWINE_MLD* lpNext; */ /* not used so far */
57 UINT mmdIndex
; /* index to low-level driver in MMDrvs table */
58 DWORD dwDriverInstance
; /* this value is driver related, as opposed to
59 * opendesc.dwInstance which is client (callback) related */
63 DWORD dwClientInstance
;
64 } WINE_MLD
, *LPWINE_MLD
;
68 } WINE_WAVE
, *LPWINE_WAVE
;
72 MIDIOPENDESC mod
; /* FIXME: should be removed */
73 } WINE_MIDI
, *LPWINE_MIDI
;
77 } WINE_MIXER
, *LPWINE_MIXER
;
79 extern BOOL
MMDRV_Init(void);
80 extern UINT
MMDRV_GetNum(UINT
);
81 extern LPWINE_MLD
MMDRV_Alloc(UINT size
, UINT type
, LPHANDLE hndl
, DWORD
* dwFlags
,
82 DWORD
* dwCallback
, DWORD
* dwInstance
, BOOL bFrom32
);
83 extern void MMDRV_Free(HANDLE hndl
, LPWINE_MLD mld
);
84 extern DWORD
MMDRV_Open(LPWINE_MLD mld
, UINT wMsg
, DWORD dwParam1
, DWORD dwParam2
);
85 extern DWORD
MMDRV_Close(LPWINE_MLD mld
, UINT wMsg
);
86 extern LPWINE_MLD
MMDRV_Get(HANDLE hndl
, UINT type
, BOOL bCanBeID
);
87 extern LPWINE_MLD
MMDRV_GetRelated(HANDLE hndl
, UINT srcType
, BOOL bSrcCanBeID
, UINT dstTyped
);
88 extern DWORD
MMDRV_Message(LPWINE_MLD mld
, WORD wMsg
, DWORD dwParam1
, DWORD dwParam2
, BOOL bFrom32
);
89 extern UINT
MMDRV_PhysicalFeatures(LPWINE_MLD mld
, UINT uMsg
, DWORD dwParam1
, DWORD dwParam2
);
93 #define MMDRV_MIDIIN 2
94 #define MMDRV_MIDIOUT 3
95 #define MMDRV_WAVEIN 4
96 #define MMDRV_WAVEOUT 5
99 #define WINE_MMTHREAD_CREATED 0x4153494C /* "BSIL" */
100 #define WINE_MMTHREAD_DELETED 0xDEADDEAD
103 DWORD dwSignature
; /* 00 "BSIL" when ok, 0xDEADDEAD when being deleted */
104 DWORD dwCounter
; /* 04 > 1 when in mmThread functions */
105 HANDLE hThread
; /* 08 hThread */
106 DWORD dwThreadID
; /* 0C */
107 FARPROC16 fpThread
; /* 10 address of thread proc (segptr or lin depending on dwFlags) */
108 DWORD dwThreadPmt
; /* 14 parameter to be passed upon thread creation to fpThread */
109 DWORD dwSignalCount
; /* 18 counter used for signaling */
110 HANDLE hEvent
; /* 1C event */
111 HANDLE hVxD
; /* 20 return from OpenVxDHandle */
112 DWORD dwStatus
; /* 24 0x00, 0x10, 0x20, 0x30 */
113 DWORD dwFlags
; /* 28 dwFlags upon creation */
114 HANDLE16 hTask
; /* 2C handle to created task */
117 typedef struct tagWINE_MCIDRIVER
{
120 LPSTR lpstrElementName
;
121 LPSTR lpstrDeviceType
;
124 DRIVERPROC16 driverProc
;
126 YIELDPROC lpfnYieldProc
;
129 HTASK16 hCreatorTask
;
132 UINT uSpecificCmdTable
;
133 struct tagWINE_MCIDRIVER
*lpNext
;
134 } WINE_MCIDRIVER
, *LPWINE_MCIDRIVER
;
136 #define WINE_TIMER_IS32 0x80
138 typedef struct tagWINE_TIMERENTRY
{
146 struct tagWINE_TIMERENTRY
* lpNext
;
147 } WINE_TIMERENTRY
, *LPWINE_TIMERENTRY
;
149 enum mmioProcType
{MMIO_PROC_16
,MMIO_PROC_32A
,MMIO_PROC_32W
};
153 struct IOProcList
*pNext
; /* Next item in linked list */
154 FOURCC fourCC
; /* four-character code identifying IOProc */
155 LPMMIOPROC pIOProc
; /* pointer to IProc */
156 enum mmioProcType type
; /* 16, 32A or 32W */
157 int count
; /* number of objects linked to it */
160 typedef struct tagWINE_MMIO
{
162 struct tagWINE_MMIO
* lpNext
;
163 struct IOProcList
* ioProc
;
168 } WINE_MMIO
, *LPWINE_MMIO
;
170 typedef struct tagWINE_PLAYSOUND
{
176 struct tagWINE_PLAYSOUND
* lpNext
;
177 } WINE_PLAYSOUND
, *LPWINE_PLAYSOUND
;
179 typedef struct tagWINE_MM_IDATA
{
181 HANDLE hWinMM32Instance
;
182 HANDLE hWinMM16Instance
;
188 LPWINE_TIMERENTRY lpTimerList
;
190 LPWINE_TIMERENTRY lpTimers
;
192 LPWINE_MCIDRIVER lpMciDrvs
;
193 /* low level drivers (unused yet) */
194 /* LPWINE_WAVE lpWave; */
195 /* LPWINE_MIDI lpMidi; */
196 /* LPWINE_MIXER lpMixer; */
199 LRESULT (CALLBACK
* pFnMmioCallback16
)(SEGPTR
,LPMMIOINFO
,UINT
,LPARAM
,LPARAM
);
200 /* playsound and sndPlaySound */
201 WINE_PLAYSOUND
* lpPlaySound
;
204 } WINE_MM_IDATA
, *LPWINE_MM_IDATA
;
206 /* function prototypes */
208 typedef LONG (*MCIPROC16
)(DWORD
, HDRVR16
, WORD
, DWORD
, DWORD
);
209 typedef LONG (*MCIPROC
)(DWORD
, HDRVR
, DWORD
, DWORD
, DWORD
);
211 extern LPWINE_DRIVER
DRIVER_FindFromHDrvr(HDRVR hDrvr
);
212 extern BOOL
DRIVER_GetLibName(LPCSTR keyName
, LPCSTR sectName
, LPSTR buf
, int sz
);
213 extern LPWINE_DRIVER
DRIVER_TryOpenDriver32(LPCSTR fn
, LPARAM lParam2
);
215 extern LPWINE_MCIDRIVER
MCI_GetDriver(UINT16 uDevID
);
216 extern UINT
MCI_GetDriverFromString(LPCSTR str
);
217 extern DWORD
MCI_WriteString(LPSTR lpDstStr
, DWORD dstSize
, LPCSTR lpSrcStr
);
218 extern const char* MCI_MessageToString(UINT16 wMsg
);
220 extern UINT WINAPI
MCI_DefYieldProc(MCIDEVICEID wDevID
, DWORD data
);
222 extern LRESULT
MCI_CleanUp(LRESULT dwRet
, UINT wMsg
, DWORD dwParam2
, BOOL bIs32
);
224 extern DWORD
MCI_SendCommand(UINT wDevID
, UINT16 wMsg
, DWORD dwParam1
, DWORD dwParam2
, BOOL bFrom32
);
225 extern DWORD
MCI_SendCommandFrom32(UINT wDevID
, UINT16 wMsg
, DWORD dwParam1
, DWORD dwParam2
);
226 extern DWORD
MCI_SendCommandFrom16(UINT wDevID
, UINT16 wMsg
, DWORD dwParam1
, DWORD dwParam2
);
228 void CALLBACK
WINE_mmThreadEntryPoint(DWORD _pmt
);
230 void MMSYSTEM_MMTIME16to32(LPMMTIME mmt32
, const MMTIME16
* mmt16
);
231 void MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16
, const MMTIME
* mmt32
);
233 UINT
MMSYSTEM_mixerOpen(LPHMIXER lphMix
, UINT uDeviceID
, DWORD dwCallback
,
234 DWORD dwInstance
, DWORD fdwOpen
, BOOL bFrom32
);
235 UINT
MMSYSTEM_midiOutOpen(HMIDIOUT
* lphMidiOut
, UINT uDeviceID
, DWORD dwCallback
,
236 DWORD dwInstance
, DWORD dwFlags
, BOOL bFrom32
);
237 UINT
MMSYSTEM_midiInOpen(HMIDIIN
* lphMidiIn
, UINT uDeviceID
, DWORD dwCallback
,
238 DWORD dwInstance
, DWORD dwFlags
, BOOL bFrom32
);
239 MMRESULT
MMSYSTEM_MidiStream_Open(HMIDISTRM
* lphMidiStrm
, LPUINT lpuDeviceID
,
240 DWORD cMidi
, DWORD dwCallback
,
241 DWORD dwInstance
, DWORD fdwOpen
, BOOL bFrom32
);
242 UINT
MMSYSTEM_waveOpen(HANDLE
* lphndl
, UINT uDeviceID
, UINT uType
,
243 const LPWAVEFORMATEX lpFormat
, DWORD dwCallback
,
244 DWORD dwInstance
, DWORD dwFlags
, BOOL bFrom32
);
245 WORD
timeSetEventInternal(UINT wDelay
, UINT wResol
,
246 FARPROC16 lpFunc
, DWORD dwUser
, UINT wFlags
);
247 HMMIO
MMIO_Open(LPSTR szFileName
, MMIOINFO
* refmminfo
,
248 DWORD dwOpenFlags
, enum mmioProcType type
);
249 LPMMIOPROC
MMIO_InstallIOProc(FOURCC fccIOProc
, LPMMIOPROC pIOProc
,
250 DWORD dwFlags
, enum mmioProcType type
);
251 LRESULT
MMIO_SendMessage(HMMIO hmmio
, UINT uMessage
, LPARAM lParam1
,
252 LPARAM lParam2
, enum mmioProcType type
);
253 LPWINE_MMIO
MMIO_Get(LPWINE_MM_IDATA iData
, HMMIO h
);
255 BOOL
MULTIMEDIA_MciInit(void);
256 LPWINE_MM_IDATA
MULTIMEDIA_GetIData(void);
257 BOOL
MULTIMEDIA_PlaySound(const void* pszSound
, HMODULE hmod
, DWORD fdwSound
, BOOL bUnicode
);
259 LPWINE_MM_IDATA
TIME_MMTimeStart(void);
260 void TIME_MMTimeStop(void);
262 /* HANDLE16 -> HANDLE conversions */
263 #define HDRVR_32(h16) ((HDRVR)(ULONG_PTR)(h16))
264 #define HMIDI_32(h16) ((HMIDI)(ULONG_PTR)(h16))
265 #define HMIDIIN_32(h16) ((HMIDIIN)(ULONG_PTR)(h16))
266 #define HMIDIOUT_32(h16) ((HMIDIOUT)(ULONG_PTR)(h16))
267 #define HMIDISTRM_32(h16) ((HMIDISTRM)(ULONG_PTR)(h16))
268 #define HMIXER_32(h16) ((HMIXER)(ULONG_PTR)(h16))
269 #define HMIXEROBJ_32(h16) ((HMIXEROBJ)(ULONG_PTR)(h16))
270 #define HMMIO_32(h16) ((HMMIO)(ULONG_PTR)(h16))
271 #define HWAVE_32(h16) ((HWAVE)(ULONG_PTR)(h16))
272 #define HWAVEIN_32(h16) ((HWAVEIN)(ULONG_PTR)(h16))
273 #define HWAVEOUT_32(h16) ((HWAVEOUT)(ULONG_PTR)(h16))
275 /* HANDLE -> HANDLE16 conversions */
276 #define HDRVR_16(h32) (LOWORD(h32))
277 #define HMIDI_16(h32) (LOWORD(h32))
278 #define HMIDIIN_16(h32) (LOWORD(h32))
279 #define HMIDIOUT_16(h32) (LOWORD(h32))
280 #define HMIDISTRM_16(h32) (LOWORD(h32))
281 #define HMIXER_16(h32) (LOWORD(h32))
282 #define HMIXEROBJ_16(h32) (LOWORD(h32))
283 #define HMMIO_16(h32) (LOWORD(h32))
284 #define HWAVE_16(h32) (LOWORD(h32))
285 #define HWAVEIN_16(h32) (LOWORD(h32))
286 #define HWAVEOUT_16(h32) (LOWORD(h32))