mixerGetControlDetailsW: translate strings for
[wine] / dlls / winmm / winemm.h
1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
2
3 /*****************************************************************************
4  * Copyright 1998, Luiz Otavio L. Zorzella
5  *           1999, Eric Pouech
6  *
7  * Purpose:   multimedia declarations (internal to WINMM & MMSYSTEM DLLs)
8  *
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.
13  *
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.
18  *
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  *****************************************************************************
23  */
24
25 #include "mmddk.h"
26
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);
29
30 /* Who said goofy boy ? */
31 #define WINE_DI_MAGIC   0x900F1B01
32
33 typedef struct tagWINE_DRIVER
34 {
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;
51
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;
64
65 typedef struct  {
66        WINE_MLD                 mld;
67 } WINE_WAVE, *LPWINE_WAVE;
68
69 typedef struct {
70        WINE_MLD                 mld;
71        MIDIOPENDESC             mod;                    /* FIXME: should be removed */
72 } WINE_MIDI, *LPWINE_MIDI;
73
74 typedef struct {
75        WINE_MLD                 mld;
76 } WINE_MIXER, *LPWINE_MIXER;
77
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);
89
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
97
98 #define WINE_MMTHREAD_CREATED   0x4153494C      /* "BSIL" */
99 #define WINE_MMTHREAD_DELETED   0xDEADDEAD
100
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;
115
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         UINT                    uTypeCmdTable;
130         UINT                    uSpecificCmdTable;
131         struct tagWINE_MCIDRIVER*lpNext;
132 } WINE_MCIDRIVER, *LPWINE_MCIDRIVER;
133
134 #define WINE_TIMER_IS32 0x80
135
136 typedef struct tagWINE_TIMERENTRY {
137     UINT                        wDelay;
138     UINT                        wResol;
139     FARPROC16                   lpFunc;
140     DWORD                       dwUser;
141     UINT16                      wFlags;
142     UINT16                      wTimerID;
143     UINT                        uCurTime;
144     struct tagWINE_TIMERENTRY*  lpNext;
145 } WINE_TIMERENTRY, *LPWINE_TIMERENTRY;
146
147 typedef struct tagWINE_MMIO {
148     MMIOINFO                    info;
149     struct IOProcList*          ioProc;
150     BOOL                        bTmpIOProc;
151     HANDLE                      hMem;
152     SEGPTR                      buffer16;
153     struct tagWINE_MMIO*        lpNext;
154     BOOL                        bBufferLoaded;
155     DWORD                       dwFileSize;
156 } WINE_MMIO, *LPWINE_MMIO;
157
158 typedef struct tagWINE_PLAYSOUND {
159     HANDLE              hThread;
160     HANDLE              hReadyEvent;
161     BOOL                bStop;
162     LPCWSTR             pszSound;
163     HMODULE             hMod;
164     DWORD               fdwSound;
165     BOOL                bLoop;
166     BOOL                bAlloc;
167 } WINE_PLAYSOUND, *LPWINE_PLAYSOUND;
168
169 typedef struct tagWINE_MM_IDATA {
170     /* iData reference */
171     DWORD                       dwThisProcess;
172     struct tagWINE_MM_IDATA*    lpNextIData;
173     /* winmm part */
174     HANDLE                      hWinMM32Instance;
175     HANDLE                      hWinMM16Instance;
176     HANDLE                      h16Module32;
177     CRITICAL_SECTION            cs;
178     /* mm timer part */
179     HANDLE                      hMMTimer;
180     DWORD                       mmSysTimeMS;
181     LPWINE_TIMERENTRY           lpTimerList;
182     int                         nSizeLpTimers;
183     LPWINE_TIMERENTRY           lpTimers;
184     /* mci part */
185     LPWINE_MCIDRIVER            lpMciDrvs;
186     /* low level drivers (unused yet) */
187     /* LPWINE_WAVE              lpWave; */
188     /* LPWINE_MIDI              lpMidi; */
189     /* LPWINE_MIXER             lpMixer; */
190     /* mmio part */
191     LPWINE_MMIO                 lpMMIO;
192     /* playsound and sndPlaySound */
193     LPWINE_PLAYSOUND            lpPlaySound;
194 } WINE_MM_IDATA, *LPWINE_MM_IDATA;
195
196 /* function prototypes */
197
198 typedef LONG                    (*MCIPROC16)(DWORD, HDRVR16, WORD, DWORD, DWORD);
199 typedef LONG                    (*MCIPROC)(DWORD, HDRVR, DWORD, DWORD, DWORD);
200
201 extern LPWINE_DRIVER            DRIVER_FindFromHDrvr(HDRVR hDrvr);
202 extern BOOL                     DRIVER_GetLibName(LPCSTR keyName, LPCSTR sectName, LPSTR buf, int sz);
203 extern LPWINE_DRIVER            DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2);
204
205 extern LPWINE_MCIDRIVER         MCI_GetDriver(UINT16 uDevID);
206 extern UINT                     MCI_GetDriverFromString(LPCSTR str);
207 extern DWORD                    MCI_WriteString(LPSTR lpDstStr, DWORD dstSize, LPCSTR lpSrcStr);
208 extern const char*              MCI_MessageToString(UINT16 wMsg);
209
210 extern UINT             WINAPI  MCI_DefYieldProc(MCIDEVICEID wDevID, DWORD data);
211
212 extern LRESULT                  MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD dwParam2, BOOL bIs32);
213
214 extern DWORD                    MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2, BOOL bFrom32);
215 extern DWORD                    MCI_SendCommandFrom32(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2);
216 extern DWORD                    MCI_SendCommandFrom16(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2);
217
218 void            CALLBACK        WINE_mmThreadEntryPoint(DWORD _pmt);
219
220 void                            MMSYSTEM_MMTIME16to32(LPMMTIME mmt32, const MMTIME16* mmt16);
221 void                            MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16, const MMTIME* mmt32); 
222
223 BOOL                            MULTIMEDIA_MciInit(void);
224 LPWINE_MM_IDATA                 MULTIMEDIA_GetIData(void);
225
226 LPWINE_MM_IDATA                 TIME_MMTimeStart(void);
227 void                            TIME_MMTimeStop(void);