summaryrefslogtreecommitdiffstats
path: root/private/mvdm/wow32/wmmedia.h
blob: 2eae61f372a81bdce0277a786475ff80d6abd39d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
/*++ BUILD Version: 0001
 *
 *  WOW v1.0
 *
 *  Copyright (c) 1991, Microsoft Corporation
 *
 *  WMMEDIA.H
 *  WOW32 16-bit MultiMedia API support
 *
 *  History:
 *  Created 21-Jan-1992 by Mike Tricker (MikeTri), after jeffpar
 *  Changed 30-Apr-1992 by Mike Tricker (MikeTri) Added callback prototypes and structs
 *          30-Jul-1992 by Stephen Estrop (StephenE) Added MCCICommand Thunk stuff
--*/


#define MMGETOPTPTR(vp,cb,p)  {p=NULL; if (HIWORD(FETCHDWORD(vp))) GETVDMPTR(vp,cb,p);}


/*++
            Enumeration handler data for the six callback types:
--*/

typedef struct _TIMEDATA {       /* timedata */
    VPPROC    vpfnTimeFunc;      // 16 bit enumeration function
    DWORD     dwUserParam;       // user param, if required
    DWORD     dwFlags;           // flags, ieTIME_ONESHOT or TIME_PERIODIC
} TIMEDATA, *PTIMEDATA;

/*
 * A couple of handy structures that probably ought to be elsewhere.
 */

typedef struct _INSTANCEDATA {
    DWORD     dwCallback;          //Callback function or window handle
    DWORD     dwCallbackInstance;  //Instance data for callback function (only)
    DWORD     dwFlags;             //Flags
} INSTANCEDATA, *PINSTANCEDATA;

typedef struct _WAVEHDR32 {
    PWAVEHDR16 pWavehdr32;         //32 bit address to 16 bit WAVEHDR
    PWAVEHDR16 pWavehdr16;         //16 bit address to 16 bit WAVEHDR
    WAVEHDR    Wavehdr;            //32 bit address to 32 bit WAVEHDR
} WAVEHDR32, *PWAVEHDR32;

typedef struct _MIDIHDR32 {
    PMIDIHDR16 pMidihdr32;         //32 bit address to 16 bit MIDIHDR
    PMIDIHDR16 pMidihdr16;         //16 bit address to 16 bit MIDIHDR
    MIDIHDR    Midihdr;            //32 bit address to 32 bit MIDIHDR
} MIDIHDR32, *PMIDIHDR32;

/*++
            Function Prototypes:
--*/

ULONG FASTCALL WMM32CallProc32( PVDMFRAME pFrame );
ULONG FASTCALL   WMM32sndPlaySound(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32mmsystemGetVersion(PVDMFRAME pFrame);

ULONG FASTCALL   WMM32OutputDebugStr(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32DriverCallback(PVDMFRAME pFrame);

ULONG FASTCALL   WMM32joyGetNumDevs(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32joyGetDevCaps(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32joyGetPos(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32joyGetThreshold(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32joyReleaseCapture(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32joySetCapture(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32joySetThreshold(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32joySetCalibration(PVDMFRAME pFrame);

ULONG FASTCALL   WMM32midiOutGetNumDevs(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutGetDevCaps(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutGetErrorText(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutOpen(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutClose(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutPrepareHeader(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutUnprepareHeader(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutShortMsg(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutLongMsg(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutReset(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutGetVolume(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutSetVolume(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutCachePatches(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutCacheDrumPatches(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutGetID(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiOutMessage(PVDMFRAME pFrame);

ULONG FASTCALL   WMM32midiInGetNumDevs(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiInGetDevCaps(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiInGetErrorText(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiInOpen(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiInClose(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiInPrepareHeader(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiInUnprepareHeader(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiInAddBuffer(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiInStart(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiInStop(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiInReset(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiInGetID(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32midiInMessage(PVDMFRAME pFrame);

ULONG FASTCALL   WMM32auxGetNumDevs(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32auxGetDevCaps(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32auxGetVolume(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32auxSetVolume(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32auxOutMessage(PVDMFRAME pFrame);

ULONG FASTCALL   WMM32waveOutGetNumDevs(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutGetDevCaps(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutGetErrorText(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutOpen(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutClose(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutPrepareHeader(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutUnprepareHeader(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutWrite(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutPause(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutRestart(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutReset(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutGetPosition(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutGetPitch(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutSetPitch(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutGetVolume(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutSetVolume(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutGetPlaybackRate(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutSetPlaybackRate(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutBreakLoop(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutGetID(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveOutMessage(PVDMFRAME pFrame);

ULONG FASTCALL   WMM32waveInGetNumDevs(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInGetDevCaps(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInGetErrorText(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInOpen(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInClose(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInPrepareHeader(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInUnprepareHeader(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInAddBuffer(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInStart(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInStop(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInReset(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInGetPosition(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInGetID(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32waveInMessage(PVDMFRAME pFrame);

ULONG FASTCALL   WMM32timeGetSystemTime(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32timeGetTime(PVDMFRAME pFrame);

VOID    W32TimeFunc(UINT wID, UINT wMsg, DWORD dwUser, DWORD dw1, DWORD dw2);

ULONG FASTCALL   WMM32timeSetEvent(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32timeKillEvent(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32timeGetDevCaps(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32timeBeginPeriod(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32timeEndPeriod(PVDMFRAME pFrame);

ULONG FASTCALL   WMM32mciSendCommand(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32mciSendString(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32mciGetDeviceID(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32mciGetErrorString(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32mciExecute(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32mciGetDeviceIDFromElementID(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32mciGetCreatorTask(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32mciSetYieldProc(PVDMFRAME pFrame);
ULONG FASTCALL   WMM32mciGetYieldProc(PVDMFRAME pFrame);

BOOL APIENTRY WOW32DriverCallback(
                DWORD dwCallback, DWORD dwFlags, WORD wID, WORD wMsg,
                DWORD dwUser, DWORD dw1, DWORD dw2 );

UINT    WMM32mciYieldProc( MCIDEVICEID wDeviceID, DWORD dwYieldData );

VOID    W32CommonDeviceOpen( HANDLE handle, UINT uMsg, DWORD dwInstance,
                             DWORD dwParam1, DWORD dwParam2);

ULONG FASTCALL   WMM32NotifyCallbackData(PVDMFRAME pFrame);

FARPROC Get_MultiMedia_ProcAddress( LPSTR lpstrProcName );

#define GET_MULTIMEDIA_API( name, proc, error )             \
    if ( (proc) == NULL ) {                                 \
        (proc) = Get_MultiMedia_ProcAddress( (name) );      \
        if ( (proc) == NULL ) {                             \
            RETURN( (error) );                              \
        }                                                   \
    }

#define MIN_WOW_TIME_PERIOD 0x10



/* -----------------------------------------------------------------------
 *
 * MCI Command Thunks
 *
 * ----------------------------------------------------------------------- */

/**************************************************************************\
*
* MCI Command Thunks function prototypes.
*
\**************************************************************************/
INT ThunkMciCommand16( MCIDEVICEID OrigDevice, UINT OrigCommand, DWORD OrigFlags,
                       DWORD OrigParms, PDWORD pNewParms, LPWSTR *lplpCommand,
                       PUINT puTable );
INT UnThunkMciCommand16( MCIDEVICEID devID, UINT OrigCommand, DWORD OrigFlags,
                         DWORD OrigParms, DWORD NewParms, LPWSTR lpCommand,
                         UINT uTable );
DWORD AllocMciParmBlock( PDWORD pOrigFlags, DWORD OrigParms );
UINT GetSizeOfParameter( LPWSTR lpCommand );

/*************************************************************************\
* Thunk Command Parms IN
\*************************************************************************/
INT ThunkCommandViaTable( LPWSTR lpCommand, DWORD OrigFlags, DWORD OrigParms,
                          DWORD pNewParms );
DWORD ThunkBreakCmd  ( PDWORD pOrigFlags, DWORD OrigParms, DWORD pNewParms );
DWORD ThunkSysInfoCmd( PDWORD pOrigFlags, DWORD OrigParms, DWORD pNewParms );
DWORD ThunkOpenCmd   ( PDWORD pOrigFlags, DWORD OrigParms, DWORD pNewParms );
DWORD ThunkSetCmd    ( MCIDEVICEID DeviceID, PDWORD pOrigFlags,
                       DWORD OrigParms, DWORD pNewParms );
DWORD ThunkWindowCmd ( MCIDEVICEID DeviceID, PDWORD pOrigFlags,
                       DWORD OrigParms, DWORD pNewParms );
DWORD ThunkSetVideoCmd( MCIDEVICEID DeviceID, PDWORD pOrigFlags,
                        DWORD OrigParms, DWORD pNewParms );

/*************************************************************************\
* Thunk Command Parms OUT
\*************************************************************************/
INT UnThunkCommandViaTable( LPWSTR lpCommand, DWORD OrigFlags, DWORD OrigParms,
                            DWORD pNewParms, BOOL fReturnValNotThunked );
VOID UnThunkSysInfoCmd( DWORD OrigFlags, DWORD OrigParms, DWORD NewParms );
VOID UnThunkOpenCmd( DWORD OrigFlags, DWORD OrigParms, DWORD NewParms );
VOID UnThunkStatusCmd( MCIDEVICEID devID, DWORD OrigFlags,
                       DWORD OrigParms, DWORD NewParms );


#if DBG
/* -----------------------------------------------------------------------
 *
 * MCI Command Thunks Debugging Functions and Macros
 *
 * ----------------------------------------------------------------------- */
typedef struct {
    UINT    uMsg;
    LPSTR   lpstMsgName;
} MCI_MESSAGE_NAMES;

extern int                  mmDebugLevel;
extern int                  mmTraceWave;
extern int                  mmTraceMidi;
extern MCI_MESSAGE_NAMES    mciMessageNames[32];

extern VOID wow32MciSetDebugLevel( VOID );
extern VOID wow32MciDebugOutput( LPSTR lpstrFormatStr, ... );

#define dprintf( _x_ )                          wow32MciDebugOutput _x_
#define dprintf1( _x_ ) if (mmDebugLevel >= 1) {wow32MciDebugOutput _x_ ;} else
#define dprintf2( _x_ ) if (mmDebugLevel >= 2) {wow32MciDebugOutput _x_ ;} else
#define dprintf3( _x_ ) if (mmDebugLevel >= 3) {wow32MciDebugOutput _x_ ;} else
#define dprintf4( _x_ ) if (mmDebugLevel >= 4) {wow32MciDebugOutput _x_ ;} else
#define dprintf5( _x_ ) if (mmDebugLevel >= 5) {wow32MciDebugOutput _x_ ;} else

#define trace_wave( _x_ ) if (mmTraceWave) {wow32MciDebugOutput _x_ ;} else
#define trace_midi( _x_ ) if (mmTraceMidi) {wow32MciDebugOutput _x_ ;} else
#define trace_aux( _x_ )  if (mmTraceAux)  {wow32MciDebugOutput _x_ ;} else
#define trace_joy( _x_ )  if (mmTraceJoy)  {wow32MciDebugOutput _x_ ;} else


#else

#define dprintf( _x_ )
#define dprintf1( _x_ )
#define dprintf2( _x_ )
#define dprintf3( _x_ )
#define dprintf4( _x_ )
#define dprintf5( _x_ )

#define trace_wave( _x_ )
#define trace_midi( _x_ )
#define trace_aux( _x_ )
#define trace_joy( _x_ )


#endif

/* Stuff needed for MCI thunking.  Defined in MEDIA\WINMM\MCI.H but here
 * until a common place can be found
 */

extern BOOL WINAPI mciExecute (LPCSTR lpstrCommand);

extern LPWSTR FindCommandItem (MCIDEVICEID wDeviceID, LPCWSTR lpstrType,
                              LPCWSTR lpstrCommand, PUINT lpwMessage,
                              PUINT lpwTable);

extern UINT mciEatCommandEntry(LPCWSTR lpEntry, LPDWORD lpValue, PUINT lpID);

extern UINT mciGetParamSize (DWORD dwValue, UINT wID);

extern BOOL mciUnlockCommandTable (UINT wCommandTable);

#define MCI_MAX_PARAM_SLOTS 20

//
// This typedef is used to remove a compiler warning caused by implementing
// the dynamic linking of Multi-Media from WOW.
//
typedef LPWSTR (*FINDCMDITEM)(MCIDEVICEID wDeviceID, LPCWSTR lpstrType,
                              LPCWSTR lpstrCommand, PUINT lpwMessage,
                              PUINT lpwTable);