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 *****************************************************************************
27 typedef DWORD (WINAPI
*MessageProc16
)(UINT16 wDevID
, UINT16 wMsg
, DWORD dwUser
, DWORD dwParam1
, DWORD dwParam2
);
28 typedef DWORD (WINAPI
*MessageProc32
)(UINT wDevID
, UINT wMsg
, DWORD dwUser
, DWORD dwParam1
, DWORD dwParam2
);
30 /* Who said goofy boy ? */
31 #define WINE_DI_MAGIC 0x900F1B01
33 typedef struct tagWINE_DRIVER
36 /* as usual LPWINE_DRIVER == hDriver32 */
48 struct tagWINE_DRIVER
* lpPrevItem
;
49 struct tagWINE_DRIVER
* lpNextItem
;
50 } WINE_DRIVER
, *LPWINE_DRIVER
;
52 typedef struct tagWINE_MLD
{
53 /* EPP struct tagWINE_MLD* lpNext; */ /* not used so far */
56 UINT mmdIndex
; /* index to low-level driver in MMDrvs table */
57 DWORD dwDriverInstance
; /* this value is driver related, as opposed to
58 * opendesc.dwInstance which is client (callback) related */
62 DWORD dwClientInstance
;
63 } WINE_MLD
, *LPWINE_MLD
;
67 } WINE_WAVE
, *LPWINE_WAVE
;
71 MIDIOPENDESC mod
; /* FIXME: should be removed */
72 } WINE_MIDI
, *LPWINE_MIDI
;
76 } WINE_MIXER
, *LPWINE_MIXER
;
78 extern BOOL
MMDRV_Init(void);
79 extern UINT
MMDRV_GetNum(UINT
);
80 extern LPWINE_MLD
MMDRV_Alloc(UINT size
, UINT type
, LPHANDLE hndl
, DWORD
* dwFlags
,
81 DWORD
* dwCallback
, DWORD
* dwInstance
, BOOL bFrom32
);
82 extern void MMDRV_Free(HANDLE hndl
, LPWINE_MLD mld
);
83 extern DWORD
MMDRV_Open(LPWINE_MLD mld
, UINT wMsg
, DWORD dwParam1
, DWORD dwParam2
);
84 extern DWORD
MMDRV_Close(LPWINE_MLD mld
, UINT wMsg
);
85 extern LPWINE_MLD
MMDRV_Get(HANDLE hndl
, UINT type
, BOOL bCanBeID
);
86 extern LPWINE_MLD
MMDRV_GetRelated(HANDLE hndl
, UINT srcType
, BOOL bSrcCanBeID
, UINT dstTyped
);
87 extern DWORD
MMDRV_Message(LPWINE_MLD mld
, WORD wMsg
, DWORD dwParam1
, DWORD dwParam2
, BOOL bFrom32
);
88 extern UINT
MMDRV_PhysicalFeatures(LPWINE_MLD mld
, UINT uMsg
, DWORD dwParam1
, DWORD dwParam2
);
92 #define MMDRV_MIDIIN 2
93 #define MMDRV_MIDIOUT 3
94 #define MMDRV_WAVEIN 4
95 #define MMDRV_WAVEOUT 5
98 #define WINE_MMTHREAD_CREATED 0x4153494C /* "BSIL" */
99 #define WINE_MMTHREAD_DELETED 0xDEADDEAD
102 DWORD dwSignature
; /* 00 "BSIL" when ok, 0xDEADDEAD when being deleted */
103 DWORD dwCounter
; /* 04 > 1 when in mmThread functions */
104 HANDLE hThread
; /* 08 hThread */
105 DWORD dwThreadID
; /* 0C */
106 FARPROC16 fpThread
; /* 10 address of thread proc (segptr or lin depending on dwFlags) */
107 DWORD dwThreadPmt
; /* 14 parameter to be passed upon thread creation to fpThread */
108 DWORD dwSignalCount
; /* 18 counter used for signaling */
109 HANDLE hEvent
; /* 1C event */
110 HANDLE hVxD
; /* 20 return from OpenVxDHandle */
111 DWORD dwStatus
; /* 24 0x00, 0x10, 0x20, 0x30 */
112 DWORD dwFlags
; /* 28 dwFlags upon creation */
113 HANDLE16 hTask
; /* 2C handle to created task */
116 typedef struct tagWINE_MCIDRIVER
{
119 LPSTR lpstrElementName
;
120 LPSTR lpstrDeviceType
;
123 DRIVERPROC16 driverProc
;
125 YIELDPROC lpfnYieldProc
;
128 HTASK16 hCreatorTask
;
131 UINT uSpecificCmdTable
;
132 struct tagWINE_MCIDRIVER
*lpNext
;
133 } WINE_MCIDRIVER
, *LPWINE_MCIDRIVER
;
135 #define WINE_TIMER_IS32 0x80
137 typedef struct tagWINE_TIMERENTRY
{
145 struct tagWINE_TIMERENTRY
* lpNext
;
146 } WINE_TIMERENTRY
, *LPWINE_TIMERENTRY
;
148 typedef struct tagWINE_MMIO
{
150 struct IOProcList
* ioProc
;
154 struct tagWINE_MMIO
* lpNext
;
157 } WINE_MMIO
, *LPWINE_MMIO
;
159 typedef struct tagWINE_PLAYSOUND
{
165 struct tagWINE_PLAYSOUND
* lpNext
;
166 } WINE_PLAYSOUND
, *LPWINE_PLAYSOUND
;
168 typedef struct tagWINE_MM_IDATA
{
169 /* iData reference */
171 struct tagWINE_MM_IDATA
* lpNextIData
;
173 HANDLE hWinMM32Instance
;
174 HANDLE hWinMM16Instance
;
180 LPWINE_TIMERENTRY lpTimerList
;
182 LPWINE_TIMERENTRY lpTimers
;
184 LPWINE_MCIDRIVER lpMciDrvs
;
185 /* low level drivers (unused yet) */
186 /* LPWINE_WAVE lpWave; */
187 /* LPWINE_MIDI lpMidi; */
188 /* LPWINE_MIXER lpMixer; */
191 /* playsound and sndPlaySound */
192 WINE_PLAYSOUND
* lpPlaySound
;
195 } WINE_MM_IDATA
, *LPWINE_MM_IDATA
;
197 /* function prototypes */
199 typedef LONG (*MCIPROC16
)(DWORD
, HDRVR16
, WORD
, DWORD
, DWORD
);
200 typedef LONG (*MCIPROC
)(DWORD
, HDRVR
, DWORD
, DWORD
, DWORD
);
202 extern LPWINE_DRIVER
DRIVER_FindFromHDrvr(HDRVR hDrvr
);
203 extern BOOL
DRIVER_GetLibName(LPCSTR keyName
, LPCSTR sectName
, LPSTR buf
, int sz
);
204 extern LPWINE_DRIVER
DRIVER_TryOpenDriver32(LPCSTR fn
, LPARAM lParam2
);
206 extern LPWINE_MCIDRIVER
MCI_GetDriver(UINT16 uDevID
);
207 extern UINT
MCI_GetDriverFromString(LPCSTR str
);
208 extern DWORD
MCI_WriteString(LPSTR lpDstStr
, DWORD dstSize
, LPCSTR lpSrcStr
);
209 extern const char* MCI_MessageToString(UINT16 wMsg
);
211 extern UINT WINAPI
MCI_DefYieldProc(MCIDEVICEID wDevID
, DWORD data
);
213 extern LRESULT
MCI_CleanUp(LRESULT dwRet
, UINT wMsg
, DWORD dwParam2
, BOOL bIs32
);
215 extern DWORD
MCI_SendCommand(UINT wDevID
, UINT16 wMsg
, DWORD dwParam1
, DWORD dwParam2
, BOOL bFrom32
);
216 extern DWORD
MCI_SendCommandFrom32(UINT wDevID
, UINT16 wMsg
, DWORD dwParam1
, DWORD dwParam2
);
217 extern DWORD
MCI_SendCommandFrom16(UINT wDevID
, UINT16 wMsg
, DWORD dwParam1
, DWORD dwParam2
);
219 void CALLBACK
WINE_mmThreadEntryPoint(DWORD _pmt
);
221 void MMSYSTEM_MMTIME16to32(LPMMTIME mmt32
, const MMTIME16
* mmt16
);
222 void MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16
, const MMTIME
* mmt32
);
224 BOOL
MULTIMEDIA_MciInit(void);
225 LPWINE_MM_IDATA
MULTIMEDIA_GetIData(void);
227 LPWINE_MM_IDATA
TIME_MMTimeStart(void);
228 void TIME_MMTimeStop(void);
230 /* HANDLE16 -> HANDLE conversions */
231 #define HMIDI_32(h16) ((HMIDI)(ULONG_PTR)(h16))
232 #define HMIDIIN_32(h16) ((HMIDIIN)(ULONG_PTR)(h16))
233 #define HMIDIOUT_32(h16) ((HMIDIOUT)(ULONG_PTR)(h16))
234 #define HMIDISTRM_32(h16) ((HMIDISTRM)(ULONG_PTR)(h16))
235 #define HWAVE_32(h16) ((HWAVE)(ULONG_PTR)(h16))
236 #define HWAVEIN_32(h16) ((HWAVEIN)(ULONG_PTR)(h16))
237 #define HWAVEOUT_32(h16) ((HWAVEOUT)(ULONG_PTR)(h16))
239 /* HANDLE -> HANDLE16 conversions */
240 #define HMIDI_16(h32) (LOWORD(h32))
241 #define HMIDIIN_16(h32) (LOWORD(h32))
242 #define HMIDIOUT_16(h32) (LOWORD(h32))
243 #define HMIDISTRM_16(h32) (LOWORD(h32))
244 #define HWAVE_16(h32) (LOWORD(h32))
245 #define HWAVEIN_16(h32) (LOWORD(h32))
246 #define HWAVEOUT_16(h32) (LOWORD(h32))