- Converted HWAVE, HWAVEIN, HWAVEOUT to void*.
[wine/multimedia.git] / dlls / winmm / winemm.h
blobc7d6fdc6ebc3a7c2a0b1bbaa4b815e64779e5533
1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
3 /*****************************************************************************
4 * Copyright 1998, Luiz Otavio L. Zorzella
5 * 1999, Eric Pouech
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 *****************************************************************************
25 #include "mmddk.h"
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
35 DWORD dwMagic;
36 /* as usual LPWINE_DRIVER == hDriver32 */
37 DWORD dwFlags;
38 union {
39 struct {
40 HMODULE hModule;
41 DRIVERPROC lpDrvProc;
42 DWORD dwDriverID;
43 } d32;
44 struct {
45 HDRVR16 hDriver16;
46 } d16;
47 } d;
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 */
54 UINT uDeviceID;
55 UINT type;
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 */
59 WORD bFrom32;
60 WORD dwFlags;
61 DWORD dwCallback;
62 DWORD dwClientInstance;
63 } WINE_MLD, *LPWINE_MLD;
65 typedef struct {
66 WINE_MLD mld;
67 } WINE_WAVE, *LPWINE_WAVE;
69 typedef struct {
70 WINE_MLD mld;
71 MIDIOPENDESC mod; /* FIXME: should be removed */
72 } WINE_MIDI, *LPWINE_MIDI;
74 typedef struct {
75 WINE_MLD mld;
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);
90 #define MMDRV_AUX 0
91 #define MMDRV_MIXER 1
92 #define MMDRV_MIDIIN 2
93 #define MMDRV_MIDIOUT 3
94 #define MMDRV_WAVEIN 4
95 #define MMDRV_WAVEOUT 5
96 #define MMDRV_MAX 6
98 #define WINE_MMTHREAD_CREATED 0x4153494C /* "BSIL" */
99 #define WINE_MMTHREAD_DELETED 0xDEADDEAD
101 typedef struct {
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 */
114 } WINE_MMTHREAD;
116 typedef struct tagWINE_MCIDRIVER {
117 UINT wDeviceID;
118 UINT wType;
119 LPSTR lpstrElementName;
120 LPSTR lpstrDeviceType;
121 LPSTR lpstrAlias;
122 HDRVR hDriver;
123 DRIVERPROC16 driverProc;
124 DWORD dwPrivate;
125 YIELDPROC lpfnYieldProc;
126 DWORD dwYieldData;
127 BOOL bIs32;
128 HTASK16 hCreatorTask;
129 DWORD CreatorThread;
130 UINT uTypeCmdTable;
131 UINT uSpecificCmdTable;
132 struct tagWINE_MCIDRIVER*lpNext;
133 } WINE_MCIDRIVER, *LPWINE_MCIDRIVER;
135 #define WINE_TIMER_IS32 0x80
137 typedef struct tagWINE_TIMERENTRY {
138 UINT wDelay;
139 UINT wResol;
140 FARPROC16 lpFunc;
141 DWORD dwUser;
142 UINT16 wFlags;
143 UINT16 wTimerID;
144 UINT uCurTime;
145 struct tagWINE_TIMERENTRY* lpNext;
146 } WINE_TIMERENTRY, *LPWINE_TIMERENTRY;
148 typedef struct tagWINE_MMIO {
149 MMIOINFO info;
150 struct IOProcList* ioProc;
151 BOOL bTmpIOProc;
152 HANDLE hMem;
153 SEGPTR buffer16;
154 struct tagWINE_MMIO* lpNext;
155 BOOL bBufferLoaded;
156 DWORD dwFileSize;
157 } WINE_MMIO, *LPWINE_MMIO;
159 typedef struct tagWINE_PLAYSOUND {
160 BOOL bLoop : 1,
161 bAlloc : 1;
162 LPCWSTR pszSound;
163 HMODULE hMod;
164 DWORD fdwSound;
165 struct tagWINE_PLAYSOUND* lpNext;
166 } WINE_PLAYSOUND, *LPWINE_PLAYSOUND;
168 typedef struct tagWINE_MM_IDATA {
169 /* iData reference */
170 DWORD dwThisProcess;
171 struct tagWINE_MM_IDATA* lpNextIData;
172 /* winmm part */
173 HANDLE hWinMM32Instance;
174 HANDLE hWinMM16Instance;
175 HANDLE h16Module32;
176 CRITICAL_SECTION cs;
177 /* mm timer part */
178 HANDLE hMMTimer;
179 DWORD mmSysTimeMS;
180 LPWINE_TIMERENTRY lpTimerList;
181 int nSizeLpTimers;
182 LPWINE_TIMERENTRY lpTimers;
183 /* mci part */
184 LPWINE_MCIDRIVER lpMciDrvs;
185 /* low level drivers (unused yet) */
186 /* LPWINE_WAVE lpWave; */
187 /* LPWINE_MIDI lpMidi; */
188 /* LPWINE_MIXER lpMixer; */
189 /* mmio part */
190 LPWINE_MMIO lpMMIO;
191 /* playsound and sndPlaySound */
192 WINE_PLAYSOUND* lpPlaySound;
193 HANDLE psLastEvent;
194 HANDLE psStopEvent;
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))