4 * Copyright 1993 Martin Ayotte
6 static char Copyright
[] = "Copyright Martin Ayotte, 1993";
12 #include <sys/ioctl.h>
18 static WORD mciActiveDev
= 0;
19 static BOOL mmTimeStarted
= FALSE
;
20 static MMTIME mmSysTimeMS
;
21 static MMTIME mmSysTimeSMPTE
;
23 typedef struct tagTIMERENTRY
{
31 struct tagTIMERENTRY
*Next
;
32 struct tagTIMERENTRY
*Prev
;
34 typedef TIMERENTRY
*LPTIMERENTRY
;
36 static LPTIMERENTRY lpTimerList
= NULL
;
38 static MCI_OPEN_DRIVER_PARMS mciDrv
[MAXMCIDRIVERS
];
40 UINT WINAPI
midiGetErrorText(UINT uError
, LPSTR lpText
, UINT uSize
);
41 UINT WINAPI
waveGetErrorText(UINT uError
, LPSTR lpText
, UINT uSize
);
42 LRESULT
DrvDefDriverProc(DWORD dwDevID
, HDRVR hDriv
, WORD wMsg
,
43 DWORD dwParam1
, DWORD dwParam2
);
46 /**************************************************************************
47 * MMSYSTEM_WEP [MMSYSTEM.1]
49 int MMSYSTEM_WEP(HANDLE hInstance
, WORD wDataSeg
,
50 WORD cbHeapSize
, LPSTR lpCmdLine
)
52 printf("MMSYSTEM DLL INIT ... hInst=%04X \n", hInstance
);
56 /**************************************************************************
57 * sndPlaySound [MMSYSTEM.2]
59 BOOL WINAPI
sndPlaySound(LPCSTR lpszSoundName
, UINT uFlags
)
64 PCMWAVEFORMAT pcmWaveFormat
;
67 WAVEOPENDESC WaveDesc
;
71 printf("sndPlaySound // SoundName='%s' uFlags=%04X !\n",
72 lpszSoundName
, uFlags
);
73 if (lpszSoundName
== NULL
) {
74 printf("sndPlaySound // Stop !\n");
77 hmmio
= mmioOpen((LPSTR
)lpszSoundName
, NULL
,
78 MMIO_ALLOCBUF
| MMIO_READ
| MMIO_DENYWRITE
);
80 printf("sndPlaySound // searching in SystemSound List !\n");
81 GetProfileString("Sounds", (LPSTR
)lpszSoundName
, "", str
, sizeof(str
));
82 if (strlen(str
) == 0) return FALSE
;
83 if ( (ptr
= (LPSTR
)strchr(str
, ',')) != NULL
) *ptr
= '\0';
84 hmmio
= mmioOpen(str
, NULL
, MMIO_ALLOCBUF
| MMIO_READ
| MMIO_DENYWRITE
);
86 printf("sndPlaySound // can't find SystemSound='%s' !\n", str
);
90 if (mmioDescend(hmmio
, &ckMainRIFF
, NULL
, 0) != 0) {
91 ErrSND
: if (hmmio
!= 0) mmioClose(hmmio
, 0);
94 printf("sndPlaySound // ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
95 (LPSTR
)&ckMainRIFF
.ckid
, (LPSTR
)&ckMainRIFF
.fccType
,
97 if ((ckMainRIFF
.ckid
!= FOURCC_RIFF
) ||
98 (ckMainRIFF
.fccType
!= mmioFOURCC('W', 'A', 'V', 'E'))) goto ErrSND
;
99 mmckInfo
.ckid
= mmioFOURCC('f', 'm', 't', ' ');
100 if (mmioDescend(hmmio
, &mmckInfo
, &ckMainRIFF
, MMIO_FINDCHUNK
) != 0) goto ErrSND
;
101 printf("sndPlaySound // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
102 (LPSTR
)&mmckInfo
.ckid
, (LPSTR
)&mmckInfo
.fccType
,
104 if (mmioRead(hmmio
, (HPSTR
) &pcmWaveFormat
,
105 (long) sizeof(PCMWAVEFORMAT
)) != (long) sizeof(PCMWAVEFORMAT
)) goto ErrSND
;
106 mmckInfo
.ckid
= mmioFOURCC('d', 'a', 't', 'a');
107 if (mmioDescend(hmmio
, &mmckInfo
, &ckMainRIFF
, MMIO_FINDCHUNK
) != 0) goto ErrSND
;
108 printf("sndPlaySound // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
109 (LPSTR
)&mmckInfo
.ckid
, (LPSTR
)&mmckInfo
.fccType
,
112 WaveDesc
.lpFormat
= (LPWAVEFORMAT
)&pcmWaveFormat
;
113 pcmWaveFormat
.wf
.wFormatTag
= WAVE_FORMAT_PCM
;
114 /* pcmWaveFormat.wBitsPerSample = 8;
115 pcmWaveFormat.wf.nChannels = 1;
116 pcmWaveFormat.wf.nSamplesPerSec = 11025;
117 pcmWaveFormat.wf.nBlockAlign = 1; */
118 pcmWaveFormat
.wf
.nAvgBytesPerSec
=
119 pcmWaveFormat
.wf
.nSamplesPerSec
* pcmWaveFormat
.wf
.nBlockAlign
;
120 dwRet
= wodMessage(0, WODM_OPEN
, 0, (DWORD
)&WaveDesc
, CALLBACK_NULL
);
121 if (dwRet
!= MMSYSERR_NOERROR
) {
122 printf("sndPlaySound // can't open WaveOut device !\n");
125 WaveHdr
.lpData
= (LPSTR
) malloc(64000);
126 WaveHdr
.dwBufferLength
= 32000;
128 WaveHdr
.dwFlags
= 0L;
129 WaveHdr
.dwLoops
= 0L;
130 dwRet
= wodMessage(0, WODM_PREPARE
, 0, (DWORD
)&WaveHdr
, sizeof(WAVEHDR
));
131 if (dwRet
!= MMSYSERR_NOERROR
) {
132 printf("sndPlaySound // can't prepare WaveOut device !\n");
133 free(WaveHdr
.lpData
);
137 count
= mmioRead(hmmio
, WaveHdr
.lpData
, WaveHdr
.dwBufferLength
);
138 if (count
< 1) break;
139 WaveHdr
.dwBytesRecorded
= count
;
140 wodMessage(0, WODM_WRITE
, 0, (DWORD
)&WaveHdr
, sizeof(WAVEHDR
));
142 wodMessage(0, WODM_UNPREPARE
, 0, (DWORD
)&WaveHdr
, sizeof(WAVEHDR
));
143 wodMessage(0, WODM_CLOSE
, 0, 0L, 0L);
144 free(WaveHdr
.lpData
);
145 if (hmmio
!= 0) mmioClose(hmmio
, 0);
149 /**************************************************************************
150 * mmsystemGetVersion [MMSYSTEM.5]
152 WORD WINAPI
mmsystemGetVersion()
154 printf("mmsystemGetVersion // 0.4.0 ...?... :-) !\n");
158 /**************************************************************************
159 * DriverProc [MMSYSTEM.6]
161 LRESULT
DriverProc(DWORD dwDevID
, HDRVR hDriv
, WORD wMsg
,
162 DWORD dwParam1
, DWORD dwParam2
)
164 return DrvDefDriverProc(dwDevID
, hDriv
, wMsg
, dwParam1
, dwParam2
);
167 /**************************************************************************
168 * OutputDebugStr [MMSYSTEM.30]
170 void WINAPI
OutputDebugStr(LPCSTR str
)
172 printf("EMPTY STUB !!! OutputDebugStr('%s');\n", str
);
175 /**************************************************************************
176 * DriverCallback [MMSYSTEM.31]
178 BOOL
DriverCallback(DWORD dwCallBack
, UINT uFlags
, HANDLE hDev
,
179 WORD wMsg
, DWORD dwUser
, DWORD dwParam1
, DWORD dwParam2
)
181 printf("DriverCallback(%08X, %04X, %04X, %04X, %08X, %08X, %08X); !\n",
182 dwCallBack
, uFlags
, hDev
, wMsg
, dwUser
, dwParam1
, dwParam2
);
183 switch(uFlags
& DCB_TYPEMASK
) {
185 printf("DriverCallback() // CALLBACK_NULL !\n");
188 printf("DriverCallback() // CALLBACK_WINDOW !\n");
191 printf("DriverCallback() // CALLBACK_TASK !\n");
194 printf("DriverCallback() // CALLBACK_FUNCTION !\n");
200 /**************************************************************************
201 * JoyGetNumDevs [MMSYSTEM.101]
205 printf("EMPTY STUB !!! JoyGetNumDevs();\n");
209 /**************************************************************************
210 * JoyGetDevCaps [MMSYSTEM.102]
212 WORD
JoyGetDevCaps(WORD wID
, LPJOYCAPS lpCaps
, WORD wSize
)
214 printf("EMPTY STUB !!! JoyGetDevCaps(%04X, %08X, %d);\n",
216 return MMSYSERR_NODRIVER
;
219 /**************************************************************************
220 * JoyGetPos [MMSYSTEM.103]
222 WORD
JoyGetPos(WORD wID
, LPJOYINFO lpInfo
)
224 printf("EMPTY STUB !!! JoyGetPos(%04X, %08X);\n", wID
, lpInfo
);
225 return MMSYSERR_NODRIVER
;
228 /**************************************************************************
229 * JoyGetThreshold [MMSYSTEM.104]
231 WORD
JoyGetThreshold(WORD wID
, LPWORD lpThreshold
)
233 printf("EMPTY STUB !!! JoyGetThreshold(%04X, %08X);\n", wID
, lpThreshold
);
234 return MMSYSERR_NODRIVER
;
237 /**************************************************************************
238 * JoyReleaseCapture [MMSYSTEM.105]
240 WORD
JoyReleaseCapture(WORD wID
)
242 printf("EMPTY STUB !!! JoyReleaseCapture(%04X);\n", wID
);
243 return MMSYSERR_NODRIVER
;
246 /**************************************************************************
247 * JoySetCapture [MMSYSTEM.106]
249 WORD
JoySetCapture(HWND hWnd
, WORD wID
, WORD wPeriod
, BOOL bChanged
)
251 printf("EMPTY STUB !!! JoySetCapture(%04X, %04X, %d, %d);\n",
252 hWnd
, wID
, wPeriod
, bChanged
);
253 return MMSYSERR_NODRIVER
;
256 /**************************************************************************
257 * JoySetThreshold [MMSYSTEM.107]
259 WORD
JoySetThreshold(WORD wID
, WORD wThreshold
)
261 printf("EMPTY STUB !!! JoySetThreshold(%04X, %d);\n", wID
, wThreshold
);
262 return MMSYSERR_NODRIVER
;
265 /**************************************************************************
266 * JoySetCalibration [MMSYSTEM.109]
268 WORD
JoySetCalibration(WORD wID
)
270 printf("EMPTY STUB !!! JoySetCalibration(%04X);\n", wID
);
271 return MMSYSERR_NODRIVER
;
275 /**************************************************************************
276 * auxGetNumDevs [MMSYSTEM.350]
278 UINT WINAPI
auxGetNumDevs()
281 printf("auxGetNumDevs !\n");
282 count
+= auxMessage(0, AUXDM_GETNUMDEVS
, 0L, 0L, 0L);
283 printf("auxGetNumDevs return %u \n", count
);
287 /**************************************************************************
288 * auxGetDevCaps [MMSYSTEM.351]
290 UINT WINAPI
auxGetDevCaps(UINT uDeviceID
, AUXCAPS FAR
* lpCaps
, UINT uSize
)
292 printf("auxGetDevCaps !\n");
296 /**************************************************************************
297 * auxGetVolume [MMSYSTEM.352]
299 UINT WINAPI
auxGetVolume(UINT uDeviceID
, DWORD FAR
* lpdwVolume
)
301 printf("auxGetVolume !\n");
305 /**************************************************************************
306 * auxSetVolume [MMSYSTEM.353]
308 UINT WINAPI
auxSetVolume(UINT uDeviceID
, DWORD dwVolume
)
310 printf("auxSetVolume !\n");
314 /**************************************************************************
315 * auxOutMessage [MMSYSTEM.354]
317 DWORD WINAPI
auxOutMessage(UINT uDeviceID
, UINT uMessage
, DWORD dw1
, DWORD dw2
)
319 printf("auxOutMessage !\n");
323 /**************************************************************************
324 * mciGetErrorString [MMSYSTEM.706]
326 BOOL
mciGetErrorString (DWORD wError
, LPSTR lpstrBuffer
, UINT uLength
)
330 printf("mciGetErrorString(%04X, %08X, %d);\n", wError
, lpstrBuffer
, uLength
);
331 if ((lpstrBuffer
== NULL
) || (uLength
< 1)) return(FALSE
);
332 lpstrBuffer
[0] = '\0';
334 case MCIERR_INVALID_DEVICE_ID
:
335 msgptr
= "Invalid MCI device ID. Use the ID returned when opening the MCI device.";
337 case MCIERR_UNRECOGNIZED_KEYWORD
:
338 msgptr
= "The driver cannot recognize the specified command parameter.";
340 case MCIERR_UNRECOGNIZED_COMMAND
:
341 msgptr
= "The driver cannot recognize the specified command.";
343 case MCIERR_HARDWARE
:
344 msgptr
= "There is a problem with your media device. Make sure it is working correctly or contact the device manufacturer.";
346 case MCIERR_INVALID_DEVICE_NAME
:
347 msgptr
= "The specified device is not open or is not recognized by MCI.";
349 case MCIERR_OUT_OF_MEMORY
:
350 msgptr
= "Not enough memory available for this task. \nQuit one or more applications to increase available memory, and then try again.";
352 case MCIERR_DEVICE_OPEN
:
353 msgptr
= "The device name is already being used as an alias by this application. Use a unique alias.";
355 case MCIERR_CANNOT_LOAD_DRIVER
:
356 msgptr
= "There is an undetectable problem in loading the specified device driver.";
358 case MCIERR_MISSING_COMMAND_STRING
:
359 msgptr
= "No command was specified.";
361 case MCIERR_PARAM_OVERFLOW
:
362 msgptr
= "The output string was to large to fit in the return buffer. Increase the size of the buffer.";
364 case MCIERR_MISSING_STRING_ARGUMENT
:
365 msgptr
= "The specified command requires a character-string parameter. Please provide one.";
367 case MCIERR_BAD_INTEGER
:
368 msgptr
= "The specified integer is invalid for this command.";
370 case MCIERR_PARSER_INTERNAL
:
371 msgptr
= "The device driver returned an invalid return type. Check with the device manufacturer about obtaining a new driver.";
373 case MCIERR_DRIVER_INTERNAL
:
374 msgptr
= "There is a problem with the device driver. Check with the device manufacturer about obtaining a new driver.";
376 case MCIERR_MISSING_PARAMETER
:
377 msgptr
= "The specified command requires a parameter. Please supply one.";
379 case MCIERR_UNSUPPORTED_FUNCTION
:
380 msgptr
= "The MCI device you are using does not support the specified command.";
382 case MCIERR_FILE_NOT_FOUND
:
383 msgptr
= "Cannot find the specified file. Make sure the path and filename are correct.";
385 case MCIERR_DEVICE_NOT_READY
:
386 msgptr
= "The device driver is not ready.";
388 case MCIERR_INTERNAL
:
389 msgptr
= "A problem occurred in initializing MCI. Try restarting Windows.";
392 msgptr
= "There is a problem with the device driver. The driver has closed. Cannot access error.";
394 case MCIERR_CANNOT_USE_ALL
:
395 msgptr
= "Cannot use 'all' as the device name with the specified command.";
397 case MCIERR_MULTIPLE
:
398 msgptr
= "Errors occurred in more than one device. Specify each command and device separately to determine which devices caused the error";
400 case MCIERR_EXTENSION_NOT_FOUND
:
401 msgptr
= "Cannot determine the device type from the given filename extension.";
403 case MCIERR_OUTOFRANGE
:
404 msgptr
= "The specified parameter is out of range for the specified command.";
406 case MCIERR_FLAGS_NOT_COMPATIBLE
:
407 msgptr
= "The specified parameters cannot be used together.";
409 case MCIERR_FILE_NOT_SAVED
:
410 msgptr
= "Cannot save the specified file. Make sure you have enough disk space or are still connected to the network.";
412 case MCIERR_DEVICE_TYPE_REQUIRED
:
413 msgptr
= "Cannot find the specified device. Make sure it is installed or that the device name is spelled correctly.";
415 case MCIERR_DEVICE_LOCKED
:
416 msgptr
= "The specified device is now being closed. Wait a few seconds, and then try again.";
418 case MCIERR_DUPLICATE_ALIAS
:
419 msgptr
= "The specified alias is already being used in this application. Use a unique alias.";
421 case MCIERR_BAD_CONSTANT
:
422 msgptr
= "The specified parameter is invalid for this command.";
424 case MCIERR_MUST_USE_SHAREABLE
:
425 msgptr
= "The device driver is already in use. To share it, use the 'shareable' parameter with each 'open' command.";
427 case MCIERR_MISSING_DEVICE_NAME
:
428 msgptr
= "The specified command requires an alias, file, driver, or device name. Please supply one.";
430 case MCIERR_BAD_TIME_FORMAT
:
431 msgptr
= "The specified value for the time format is invalid. Refer to the MCI documentation for valid formats.";
433 case MCIERR_NO_CLOSING_QUOTE
:
434 msgptr
= "A closing double-quotation mark is missing from the parameter value. Please supply one.";
436 case MCIERR_DUPLICATE_FLAGS
:
437 msgptr
= "A parameter or value was specified twice. Only specify it once.";
439 case MCIERR_INVALID_FILE
:
440 msgptr
= "The specified file cannot be played on the specified MCI device. The file may be corrupt, or not in the correct format.";
442 case MCIERR_NULL_PARAMETER_BLOCK
:
443 msgptr
= "A null parameter block was passed to MCI.";
445 case MCIERR_UNNAMED_RESOURCE
:
446 msgptr
= "Cannot save an unnamed file. Supply a filename.";
448 case MCIERR_NEW_REQUIRES_ALIAS
:
449 msgptr
= "You must specify an alias when using the 'new' parameter.";
451 case MCIERR_NOTIFY_ON_AUTO_OPEN
:
452 msgptr
= "Cannot use the 'notify' flag with auto-opened devices.";
454 case MCIERR_NO_ELEMENT_ALLOWED
:
455 msgptr
= "Cannot use a filename with the specified device.";
457 case MCIERR_NONAPPLICABLE_FUNCTION
:
458 msgptr
= "Cannot carry out the commands in the order specified. Correct the command sequence, and then try again.";
460 case MCIERR_ILLEGAL_FOR_AUTO_OPEN
:
461 msgptr
= "Cannot carry out the specified command on an auto-opened device. Wait until the device is closed, and then try again.";
463 case MCIERR_FILENAME_REQUIRED
:
464 msgptr
= "The filename is invalid. Make sure the filename is not longer than 8 characters, followed by a period and an extension.";
466 case MCIERR_EXTRA_CHARACTERS
:
467 msgptr
= "Cannot specify extra characters after a string enclosed in quotation marks.";
469 case MCIERR_DEVICE_NOT_INSTALLED
:
470 msgptr
= "The specified device is not installed on the system. Use the Drivers option in Control Panel to install the device.";
473 msgptr
= "Cannot access the specified file or MCI device. Try changing directories or restarting your computer.";
476 msgptr
= "Cannot access the specified file or MCI device because the application cannot change directories.";
478 case MCIERR_SET_DRIVE
:
479 msgptr
= "Cannot access specified file or MCI device because the application cannot change drives.";
481 case MCIERR_DEVICE_LENGTH
:
482 msgptr
= "Specify a device or driver name that is less than 79 characters.";
484 case MCIERR_DEVICE_ORD_LENGTH
:
485 msgptr
= "Specify a device or driver name that is less than 69 characters.";
487 case MCIERR_NO_INTEGER
:
488 msgptr
= "The specified command requires an integer parameter. Please provide one.";
490 case MCIERR_WAVE_OUTPUTSINUSE
:
491 msgptr
= "All wave devices that can play files in the current format are in use. Wait until a wave device is free, and then try again.";
493 case MCIERR_WAVE_SETOUTPUTINUSE
:
494 msgptr
= "Cannot set the current wave device for play back because it is in use. Wait until the device is free, and then try again.";
496 case MCIERR_WAVE_INPUTSINUSE
:
497 msgptr
= "All wave devices that can record files in the current format are in use. Wait until a wave device is free, and then try again.";
499 case MCIERR_WAVE_SETINPUTINUSE
:
500 msgptr
= "Cannot set the current wave device for recording because it is in use. Wait until the device is free, and then try again.";
502 case MCIERR_WAVE_OUTPUTUNSPECIFIED
:
503 msgptr
= "Any compatible waveform playback device may be used.";
505 case MCIERR_WAVE_INPUTUNSPECIFIED
:
506 msgptr
= "Any compatible waveform recording device may be used.";
508 case MCIERR_WAVE_OUTPUTSUNSUITABLE
:
509 msgptr
= "No wave device that can play files in the current format is installed. Use the Drivers option to install the wave device.";
511 case MCIERR_WAVE_SETOUTPUTUNSUITABLE
:
512 msgptr
= "The device you are trying to play to cannot recognize the current file format.";
514 case MCIERR_WAVE_INPUTSUNSUITABLE
:
515 msgptr
= "No wave device that can record files in the current format is installed. Use the Drivers option to install the wave device.";
517 case MCIERR_WAVE_SETINPUTUNSUITABLE
:
518 msgptr
= "The device you are trying to record from cannot recognize the current file format.";
520 case MCIERR_NO_WINDOW
:
521 msgptr
= "There is no display window.";
523 case MCIERR_CREATEWINDOW
:
524 msgptr
= "Could not create or use window.";
526 case MCIERR_FILE_READ
:
527 msgptr
= "Cannot read the specified file. Make sure the file is still present, or check your disk or network connection.";
529 case MCIERR_FILE_WRITE
:
530 msgptr
= "Cannot write to the specified file. Make sure you have enough disk space or are still connected to the network.";
534 #define MCIERR_SEQ_DIV_INCOMPATIBLE (MCIERR_BASE + 80)
535 #define MCIERR_SEQ_PORT_INUSE (MCIERR_BASE + 81)
536 #define MCIERR_SEQ_PORT_NONEXISTENT (MCIERR_BASE + 82)
537 #define MCIERR_SEQ_PORT_MAPNODEVICE (MCIERR_BASE + 83)
538 #define MCIERR_SEQ_PORT_MISCERROR (MCIERR_BASE + 84)
539 #define MCIERR_SEQ_TIMER (MCIERR_BASE + 85)
540 #define MCIERR_SEQ_PORTUNSPECIFIED (MCIERR_BASE + 86)
541 #define MCIERR_SEQ_NOMIDIPRESENT (MCIERR_BASE + 87)
550 msg# 520 : digitalvideo
563 msg# 533 : milliseconds
570 msg# 540 : smpte 30 drop
576 msgptr
= "Unkown MCI Error !\n";
579 maxbuf
= min(uLength
- 1, strlen(msgptr
));
580 if (maxbuf
> 0) strncpy(lpstrBuffer
, msgptr
, maxbuf
);
581 lpstrBuffer
[maxbuf
+ 1] = '\0';
586 /**************************************************************************
587 * mciDriverNotify [MMSYSTEM.711]
589 BOOL WINAPI
mciDriverNotify(HWND hWndCallBack
, UINT wDevID
, UINT wStatus
)
591 printf("mciDriverNotify(%04X, %u, %04X)\n", hWndCallBack
, wDevID
, wStatus
);
592 if (!IsWindow(hWndCallBack
)) return FALSE
;
593 PostMessage(hWndCallBack
, MM_MCINOTIFY
, wStatus
,
594 MAKELONG(mciDrv
[wDevID
].wDeviceID
, 0));
598 /**************************************************************************
601 DWORD
mciOpen(DWORD dwParam
, LPMCI_OPEN_PARMS lpParms
)
606 printf("mciOpen(%08X, %08X)\n", dwParam
, lpParms
);
607 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
608 while(mciDrv
[wDevID
].wType
!= 0) {
609 if (++wDevID
>= MAXMCIDRIVERS
) {
610 printf("MCI_OPEN // MAXMCIDRIVERS reached !\n");
611 return MCIERR_INTERNAL
;
614 if (dwParam
& MCI_OPEN_TYPE
) {
615 if (lpParms
->lpstrDeviceType
== NULL
) return MCIERR_INTERNAL
;
616 if (dwParam
& MCI_OPEN_TYPE_ID
) {
617 printf("MCI_OPEN // Dev=%08X !\n", lpParms
->lpstrDeviceType
);
618 dwDevTyp
= (DWORD
)lpParms
->lpstrDeviceType
;
621 printf("MCI_OPEN // Dev='%s' !\n", lpParms
->lpstrDeviceType
);
622 strcpy(str
, lpParms
->lpstrDeviceType
);
624 if (strcmp(str
, "CDAUDIO") == 0) {
625 dwDevTyp
= MCI_DEVTYPE_CD_AUDIO
;
628 if (strcmp(str
, "WAVEAUDIO") == 0) {
629 dwDevTyp
= MCI_DEVTYPE_WAVEFORM_AUDIO
;
632 if (strcmp(str
, "SEQUENCER") == 0) {
633 dwDevTyp
= MCI_DEVTYPE_SEQUENCER
;
636 if (strcmp(str
, "ANIMATION1") == 0) {
637 dwDevTyp
= MCI_DEVTYPE_ANIMATION
;
640 mciDrv
[wDevID
].wType
= dwDevTyp
;
641 mciDrv
[wDevID
].wDeviceID
= 1;
642 lpParms
->wDeviceID
= wDevID
;
643 printf("MCI_OPEN // wDeviceID=%04X !\n", lpParms
->wDeviceID
);
645 case MCI_DEVTYPE_CD_AUDIO
:
647 WINELIB_UNIMP ("CDAUDIO_DriverProc");
649 return CDAUDIO_DriverProc(0, 0, MCI_OPEN_DRIVER
,
651 dwParam
, (DWORD
)lpParms
);
653 case MCI_DEVTYPE_WAVEFORM_AUDIO
:
654 return WAVE_DriverProc(0, 0, MCI_OPEN_DRIVER
,
655 dwParam
, (DWORD
)lpParms
);
656 case MCI_DEVTYPE_SEQUENCER
:
657 printf("MCI_OPEN // No SEQUENCER yet !\n");
658 return MCIERR_DEVICE_NOT_INSTALLED
;
659 case MCI_DEVTYPE_ANIMATION
:
660 printf("MCI_OPEN // No ANIMATION yet !\n");
661 return MCIERR_DEVICE_NOT_INSTALLED
;
662 case MCI_DEVTYPE_DIGITAL_VIDEO
:
663 printf("MCI_OPEN // No DIGITAL_VIDEO yet !\n");
664 return MCIERR_DEVICE_NOT_INSTALLED
;
666 printf("MCI_OPEN // Invalid Device Name '%08X' !\n", lpParms
->lpstrDeviceType
);
667 return MCIERR_INVALID_DEVICE_NAME
;
670 return MCIERR_INTERNAL
;
674 /**************************************************************************
675 * mciClose [internal]
677 DWORD
mciClose(UINT wDevID
, DWORD dwParam
, LPMCI_GENERIC_PARMS lpParms
)
679 DWORD dwRet
= MCIERR_INTERNAL
;
680 printf("mciClose(%u, %08X, %08X)\n", wDevID
, dwParam
, lpParms
);
681 switch(mciDrv
[wDevID
].wType
) {
682 case MCI_DEVTYPE_CD_AUDIO
:
684 dwRet
= CDAUDIO_DriverProc(mciDrv
[wDevID
].wDeviceID
, 0,
685 MCI_CLOSE
, dwParam
, (DWORD
)lpParms
);
688 case MCI_DEVTYPE_WAVEFORM_AUDIO
:
689 dwRet
= WAVE_DriverProc(mciDrv
[wDevID
].wDeviceID
, 0,
690 MCI_CLOSE
, dwParam
, (DWORD
)lpParms
);
693 printf("mciClose() // unknown type=%04X !\n", mciDrv
[wDevID
].wType
);
695 mciDrv
[wDevID
].wType
= 0;
700 /**************************************************************************
701 * mciSound [internal]
703 DWORD
mciSound(UINT wDevID
, DWORD dwParam
, LPMCI_SOUND_PARMS lpParms
)
705 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
706 if (dwParam
& MCI_SOUND_NAME
)
707 printf("MCI_SOUND // file='%s' !\n", lpParms
->lpstrSoundName
);
708 return MCIERR_INVALID_DEVICE_ID
;
713 /**************************************************************************
714 * mciSendCommand [MMSYSTEM.701]
716 DWORD
mciSendCommand(UINT wDevID
, UINT wMsg
, DWORD dwParam1
, DWORD dwParam2
)
720 printf("mciSendCommand(%04X, %04X, %08X, %08X)\n",
721 wDevID
, wMsg
, dwParam1
, dwParam2
);
725 return mciOpen(dwParam1
, (LPMCI_OPEN_PARMS
)dwParam2
);
727 return mciClose(wDevID
, dwParam1
, (LPMCI_GENERIC_PARMS
)dwParam2
);
729 switch(mciDrv
[wDevID
].wType
) {
730 case MCI_DEVTYPE_CD_AUDIO
:
732 return CDAUDIO_DriverProc(mciDrv
[wDevID
].wDeviceID
, hDrv
,
733 wMsg
, dwParam1
, dwParam2
);
736 case MCI_DEVTYPE_WAVEFORM_AUDIO
:
737 return WAVE_DriverProc(mciDrv
[wDevID
].wDeviceID
, hDrv
,
738 wMsg
, dwParam1
, dwParam2
);
740 printf("mciSendCommand() // unknown type=%04X !\n",
741 mciDrv
[wDevID
].wType
);
744 return MMSYSERR_INVALPARAM
;
747 /**************************************************************************
748 * mciGetDeviceID [MMSYSTEM.703]
750 UINT
mciGetDeviceID (LPCSTR lpstrName
)
753 printf("mciGetDeviceID(%s)\n", lpstrName
);
754 if (lpstrName
!= NULL
) {
755 strcpy(str
, lpstrName
);
757 if (strcmp(str
, "ALL") == 0) return MCI_ALL_DEVICE_ID
;
762 /**************************************************************************
763 * mciSendString [MMSYSTEM.702]
765 DWORD WINAPI
mciSendString (LPCSTR lpstrCommand
,
766 LPSTR lpstrReturnString
, UINT uReturnLength
, HWND hwndCallback
)
768 printf("mciSendString('%s', %lX, %u, %X)\n",
769 lpstrCommand
, lpstrReturnString
,
770 uReturnLength
, hwndCallback
);
771 return MCIERR_MISSING_COMMAND_STRING
;
774 /**************************************************************************
775 * mciSetYieldProc [MMSYSTEM.714]
777 BOOL WINAPI
mciSetYieldProc (UINT uDeviceID
,
778 YIELDPROC fpYieldProc
, DWORD dwYieldData
)
782 /**************************************************************************
783 * mciGetDeviceIDFromElementID [MMSYSTEM.715]
785 UINT WINAPI
mciGetDeviceIDFromElementID(DWORD dwElementID
, LPCSTR lpstrType
)
789 /**************************************************************************
790 * mciGetYieldProc [MMSYSTEM.716]
792 YIELDPROC WINAPI
mciGetYieldProc(UINT uDeviceID
, DWORD FAR
* lpdwYieldData
)
796 /**************************************************************************
797 * mciGetCreatorTask [MMSYSTEM.717]
799 HTASK WINAPI
mciGetCreatorTask(UINT uDeviceID
)
803 /**************************************************************************
804 * midiOutGetNumDevs [MMSYSTEM.201]
806 UINT WINAPI
midiOutGetNumDevs(void)
808 printf("midiOutGetNumDevs\n");
812 /**************************************************************************
813 * midiOutGetDevCaps [MMSYSTEM.202]
815 UINT WINAPI
midiOutGetDevCaps(UINT uDeviceID
,
816 MIDIOUTCAPS FAR
* lpCaps
, UINT uSize
)
818 printf("midiOutGetDevCaps\n");
822 /**************************************************************************
823 * midiOutGetErrorText [MMSYSTEM.203]
825 UINT WINAPI
midiOutGetErrorText(UINT uError
, LPSTR lpText
, UINT uSize
)
827 printf("midiOutGetErrorText\n");
828 return(midiGetErrorText(uError
, lpText
, uSize
));
832 /**************************************************************************
833 * midiGetErrorText [internal]
835 UINT WINAPI
midiGetErrorText(UINT uError
, LPSTR lpText
, UINT uSize
)
839 if ((lpText
== NULL
) || (uSize
< 1)) return(FALSE
);
842 case MIDIERR_UNPREPARED
:
843 msgptr
= "The MIDI header was not prepared. Use the Prepare function to prepare the header, and then try again.";
845 case MIDIERR_STILLPLAYING
:
846 msgptr
= "Cannot perform this operation while media data is still playing. Reset the device, or wait until the data is finished playing.";
849 msgptr
= "A MIDI map was not found. There may be a problem with the driver, or the MIDIMAP.CFG file may be corrupt or missing.";
851 case MIDIERR_NOTREADY
:
852 msgptr
= "The port is transmitting data to the device. Wait until the data has been transmitted, and then try again.";
854 case MIDIERR_NODEVICE
:
855 msgptr
= "The current MIDI Mapper setup refers to a MIDI device that is not installed on the system. Use MIDI Mapper to edit the setup.";
857 case MIDIERR_INVALIDSETUP
:
858 msgptr
= "The current MIDI setup is damaged. Copy the original MIDIMAP.CFG file to the Windows SYSTEM directory, and then try again.";
861 msg# 336 : Cannot use the song-pointer time format and the SMPTE time-format together.
862 msg# 337 : The specified MIDI device is already in use. Wait until it is free, and then try again.
863 msg# 338 : The specified MIDI device is not installed on the system. Use the Drivers option in Control Panel to install the driver.
864 msg# 339 : The current MIDI Mapper setup refers to a MIDI device that is not installed on the system. Use MIDI Mapper to edit the setup.
865 msg# 340 : An error occurred using the specified port.
866 msg# 341 : All multimedia timers are being used by other applications. Quit one of these applications, and then try again.
867 msg# 342 : There is no current MIDI port.
868 msg# 343 : There are no MIDI devices installed on the system. Use the Drivers option in Control Panel to install the driver.
871 msgptr
= "Unkown MIDI Error !\n";
874 maxbuf
= min(uSize
- 1, strlen(msgptr
));
875 if (maxbuf
> 0) strncpy(lpText
, msgptr
, maxbuf
);
876 lpText
[maxbuf
+ 1] = '\0';
880 /**************************************************************************
881 * midiOutOpen [MMSYSTEM.204]
883 UINT WINAPI
midiOutOpen(HMIDIOUT FAR
* lphMidiOut
, UINT uDeviceID
,
884 DWORD dwCallback
, DWORD dwInstance
, DWORD dwFlags
)
886 printf("midiOutOpen\n");
887 if (lphMidiOut
!= NULL
) *lphMidiOut
= 0;
891 /**************************************************************************
892 * midiOutClose [MMSYSTEM.205]
894 UINT WINAPI
midiOutClose(HMIDIOUT hMidiOut
)
896 printf("midiOutClose\n");
900 /**************************************************************************
901 * midiOutPrepareHeader [MMSYSTEM.206]
903 UINT WINAPI
midiOutPrepareHeader(HMIDIOUT hMidiOut
,
904 MIDIHDR FAR
* lpMidiOutHdr
, UINT uSize
)
906 printf("midiOutPrepareHeader\n");
910 /**************************************************************************
911 * midiOutUnprepareHeader [MMSYSTEM.207]
913 UINT WINAPI
midiOutUnprepareHeader(HMIDIOUT hMidiOut
,
914 MIDIHDR FAR
* lpMidiOutHdr
, UINT uSize
)
916 printf("midiOutUnprepareHeader\n");
920 /**************************************************************************
921 * midiOutShortMsg [MMSYSTEM.208]
923 UINT WINAPI
midiOutShortMsg(HMIDIOUT hMidiOut
, DWORD dwMsg
)
925 printf("midiOutShortMsg\n");
929 /**************************************************************************
930 * midiOutLongMsg [MMSYSTEM.209]
932 UINT WINAPI
midiOutLongMsg(HMIDIOUT hMidiOut
,
933 MIDIHDR FAR
* lpMidiOutHdr
, UINT uSize
)
935 printf("midiOutLongMsg\n");
939 /**************************************************************************
940 * midiOutReset [MMSYSTEM.210]
942 UINT WINAPI
midiOutReset(HMIDIOUT hMidiOut
)
944 printf("midiOutReset\n");
948 /**************************************************************************
949 * midiOutGetVolume [MMSYSTEM.211]
951 UINT WINAPI
midiOutGetVolume(UINT uDeviceID
, DWORD FAR
* lpdwVolume
)
953 printf("midiOutGetVolume\n");
957 /**************************************************************************
958 * midiOutSetVolume [MMSYSTEM.212]
960 UINT WINAPI
midiOutSetVolume(UINT uDeviceID
, DWORD dwVolume
)
962 printf("midiOutSetVolume\n");
966 /**************************************************************************
967 * midiOutCachePatches [MMSYSTEM.213]
969 UINT WINAPI
midiOutCachePatches(HMIDIOUT hMidiOut
,
970 UINT uBank
, WORD FAR
* lpwPatchArray
, UINT uFlags
)
972 printf("midiOutCachePatches\n");
976 /**************************************************************************
977 * midiOutCacheDrumPatches [MMSYSTEM.214]
979 UINT WINAPI
midiOutCacheDrumPatches(HMIDIOUT hMidiOut
,
980 UINT uPatch
, WORD FAR
* lpwKeyArray
, UINT uFlags
)
982 printf("midiOutCacheDrumPatches\n");
986 /**************************************************************************
987 * midiOutGetID [MMSYSTEM.215]
989 UINT WINAPI
midiOutGetID(HMIDIOUT hMidiOut
, UINT FAR
* lpuDeviceID
)
991 printf("midiOutGetID\n");
995 /**************************************************************************
996 * midiOutMessage [MMSYSTEM.216]
998 DWORD WINAPI
midiOutMessage(HMIDIOUT hMidiOut
, UINT uMessage
, DWORD dw1
, DWORD dw2
)
1000 printf("midiOutMessage\n");
1004 /**************************************************************************
1005 * midiInGetNumDevs [MMSYSTEM.301]
1007 UINT WINAPI
midiInGetNumDevs(void)
1009 printf("midiInGetNumDevs\n");
1013 /**************************************************************************
1014 * midiInGetDevCaps [MMSYSTEM.302]
1016 UINT WINAPI
midiInGetDevCaps(UINT uDeviceID
,
1017 LPMIDIINCAPS lpCaps
, UINT uSize
)
1019 printf("midiInGetDevCaps\n");
1023 /**************************************************************************
1024 * midiInGetErrorText [MMSYSTEM.303]
1026 UINT WINAPI
midiInGetErrorText(UINT uError
, LPSTR lpText
, UINT uSize
)
1028 printf("midiInGetErrorText\n");
1029 return (midiGetErrorText(uError
, lpText
, uSize
));
1032 /**************************************************************************
1033 * midiInOpen [MMSYSTEM.304]
1035 UINT WINAPI
midiInOpen(HMIDIIN FAR
* lphMidiIn
, UINT uDeviceID
,
1036 DWORD dwCallback
, DWORD dwInstance
, DWORD dwFlags
)
1038 printf("midiInOpen\n");
1039 if (lphMidiIn
!= NULL
) *lphMidiIn
= 0;
1043 /**************************************************************************
1044 * midiInClose [MMSYSTEM.305]
1046 UINT WINAPI
midiInClose(HMIDIIN hMidiIn
)
1048 printf("midiInClose\n");
1052 /**************************************************************************
1053 * midiInPrepareHeader [MMSYSTEM.306]
1055 UINT WINAPI
midiInPrepareHeader(HMIDIIN hMidiIn
,
1056 MIDIHDR FAR
* lpMidiInHdr
, UINT uSize
)
1058 printf("midiInPrepareHeader\n");
1062 /**************************************************************************
1063 * midiInUnprepareHeader [MMSYSTEM.307]
1065 UINT WINAPI
midiInUnprepareHeader(HMIDIIN hMidiIn
,
1066 MIDIHDR FAR
* lpMidiInHdr
, UINT uSize
)
1068 printf("midiInUnprepareHeader\n");
1072 /**************************************************************************
1073 * midiInAddBuffer [MMSYSTEM.308]
1075 UINT WINAPI
midiInAddBuffer(HMIDIIN hMidiIn
,
1076 MIDIHDR FAR
* lpMidiInHdr
, UINT uSize
)
1078 printf("midiInAddBuffer\n");
1082 /**************************************************************************
1083 * midiInStart [MMSYSTEM.309]
1085 UINT WINAPI
midiInStart(HMIDIIN hMidiIn
)
1087 printf("midiInStart\n");
1091 /**************************************************************************
1092 * midiInStop [MMSYSTEM.310]
1094 UINT WINAPI
midiInStop(HMIDIIN hMidiIn
)
1096 printf("midiInStop\n");
1100 /**************************************************************************
1101 * midiInReset [MMSYSTEM.311]
1103 UINT WINAPI
midiInReset(HMIDIIN hMidiIn
)
1105 printf("midiInReset\n");
1109 /**************************************************************************
1110 * midiInGetID [MMSYSTEM.312]
1112 UINT WINAPI
midiInGetID(HMIDIIN hMidiIn
, UINT FAR
* lpuDeviceID
)
1114 printf("midiInGetID\n");
1118 /**************************************************************************
1119 * midiInMessage [MMSYSTEM.313]
1121 DWORD WINAPI
midiInMessage(HMIDIIN hMidiIn
, UINT uMessage
,
1122 DWORD dwParam1
, DWORD dwParam2
)
1124 printf("midiInMessage\n");
1129 /**************************************************************************
1130 * waveOutGetNumDevs [MMSYSTEM.401]
1132 UINT WINAPI
waveOutGetNumDevs()
1135 printf("waveOutGetNumDevs\n");
1136 count
+= wodMessage(0, WODM_GETNUMDEVS
, 0L, 0L, 0L);
1137 printf("waveOutGetNumDevs return %u \n", count
);
1141 /**************************************************************************
1142 * waveOutGetDevCaps [MMSYSTEM.402]
1144 UINT WINAPI
waveOutGetDevCaps(UINT uDeviceID
, WAVEOUTCAPS FAR
* lpCaps
, UINT uSize
)
1146 printf("waveOutGetDevCaps\n");
1147 return wodMessage(uDeviceID
, WODM_GETDEVCAPS
, 0L, (DWORD
)lpCaps
, uSize
);
1150 /**************************************************************************
1151 * waveOutGetErrorText [MMSYSTEM.403]
1153 UINT WINAPI
waveOutGetErrorText(UINT uError
, LPSTR lpText
, UINT uSize
)
1155 printf("waveOutGetErrorText\n");
1156 return(waveGetErrorText(uError
, lpText
, uSize
));
1160 /**************************************************************************
1161 * waveGetErrorText [internal]
1163 UINT WINAPI
waveGetErrorText(UINT uError
, LPSTR lpText
, UINT uSize
)
1167 printf("waveGetErrorText(%04X, %08X, %d);\n", uError
, lpText
, uSize
);
1168 if ((lpText
== NULL
) || (uSize
< 1)) return(FALSE
);
1171 case MMSYSERR_NOERROR
:
1172 msgptr
= "The specified command was carried out.";
1174 case MMSYSERR_ERROR
:
1175 msgptr
= "Undefined external error.";
1177 case MMSYSERR_BADDEVICEID
:
1178 msgptr
= "A device ID has been used that is out of range for your system.";
1180 case MMSYSERR_NOTENABLED
:
1181 msgptr
= "The driver was not enabled.";
1183 case MMSYSERR_ALLOCATED
:
1184 msgptr
= "The specified device is already in use. Wait until it is free, and then try again.";
1186 case MMSYSERR_INVALHANDLE
:
1187 msgptr
= "The specified device handle is invalid.";
1189 case MMSYSERR_NODRIVER
:
1190 msgptr
= "There is no driver installed on your system !\n";
1192 case MMSYSERR_NOMEM
:
1193 msgptr
= "Not enough memory available for this task. Quit one or more applications to increase available memory, and then try again.";
1195 case MMSYSERR_NOTSUPPORTED
:
1196 msgptr
= "This function is not supported. Use the Capabilities function to determine which functions and messages the driver supports.";
1198 case MMSYSERR_BADERRNUM
:
1199 msgptr
= "An error number was specified that is not defined in the system.";
1201 case MMSYSERR_INVALFLAG
:
1202 msgptr
= "An invalid flag was passed to a system function.";
1204 case MMSYSERR_INVALPARAM
:
1205 msgptr
= "An invalid parameter was passed to a system function.";
1207 case WAVERR_BADFORMAT
:
1208 msgptr
= "The specified format is not supported or cannot be translated. Use the Capabilities function to determine the supported formats";
1210 case WAVERR_STILLPLAYING
:
1211 msgptr
= "Cannot perform this operation while media data is still playing. Reset the device, or wait until the data is finished playing.";
1213 case WAVERR_UNPREPARED
:
1214 msgptr
= "The wave header was not prepared. Use the Prepare function to prepare the header, and then try again.";
1217 msgptr
= "Cannot open the device without using the WAVE_ALLOWSYNC flag. Use the flag, and then try again.";
1220 msgptr
= "Unkown MMSYSTEM Error !\n";
1223 maxbuf
= min(uSize
- 1, strlen(msgptr
));
1224 if (maxbuf
> 0) strncpy(lpText
, msgptr
, maxbuf
);
1225 lpText
[maxbuf
+ 1] = '\0';
1229 /**************************************************************************
1230 * waveOutOpen [MMSYSTEM.404]
1232 UINT WINAPI
waveOutOpen(HWAVEOUT FAR
* lphWaveOut
, UINT uDeviceID
,
1233 const LPWAVEFORMAT lpFormat
, DWORD dwCallback
, DWORD dwInstance
, DWORD dwFlags
)
1236 LPWAVEOPENDESC lpDesc
;
1238 BOOL bMapperFlg
= FALSE
;
1239 printf("waveOutOpen(%08X, %d, %08X, %08X, %08X, %08X);\n",
1240 lphWaveOut
, uDeviceID
, lpFormat
, dwCallback
, dwInstance
, dwFlags
);
1241 if (dwFlags
& WAVE_FORMAT_QUERY
) {
1242 printf("waveOutOpen // WAVE_FORMAT_QUERY requested !\n");
1244 if (uDeviceID
== (UINT
)WAVE_MAPPER
) {
1245 printf("waveOutOpen // WAVE_MAPPER mode requested !\n");
1249 if (lpFormat
== NULL
) return WAVERR_BADFORMAT
;
1250 hWaveOut
= GlobalAlloc(GMEM_MOVEABLE
, sizeof(WAVEOPENDESC
));
1251 if (lphWaveOut
!= NULL
) *lphWaveOut
= hWaveOut
;
1252 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveOut
);
1253 if (lpDesc
== NULL
) return MMSYSERR_NOMEM
;
1254 lpDesc
->hWave
= hWaveOut
;
1255 lpDesc
->lpFormat
= lpFormat
;
1256 lpDesc
->dwCallBack
= dwCallback
;
1257 lpDesc
->dwInstance
= dwInstance
;
1258 while(uDeviceID
< MAXWAVEDRIVERS
) {
1259 dwRet
= wodMessage(uDeviceID
, WODM_OPEN
,
1260 lpDesc
->dwInstance
, (DWORD
)lpDesc
, 0L);
1261 if (dwRet
== MMSYSERR_NOERROR
) break;
1262 if (!bMapperFlg
) break;
1264 printf("waveOutOpen // WAVE_MAPPER mode ! try next driver...\n");
1266 if (dwFlags
& WAVE_FORMAT_QUERY
) {
1267 printf("waveOutOpen // End of WAVE_FORMAT_QUERY !\n");
1268 waveOutClose(hWaveOut
);
1273 /**************************************************************************
1274 * waveOutClose [MMSYSTEM.405]
1276 UINT WINAPI
waveOutClose(HWAVEOUT hWaveOut
)
1278 LPWAVEOPENDESC lpDesc
;
1279 printf("waveOutClose(%04X)\n", hWaveOut
);
1280 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveOut
);
1281 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1282 return wodMessage(0, WODM_CLOSE
, lpDesc
->dwInstance
, 0L, 0L);
1285 /**************************************************************************
1286 * waveOutPrepareHeader [MMSYSTEM.406]
1288 UINT WINAPI
waveOutPrepareHeader(HWAVEOUT hWaveOut
,
1289 WAVEHDR FAR
* lpWaveOutHdr
, UINT uSize
)
1291 LPWAVEOPENDESC lpDesc
;
1292 printf("waveOutPrepareHeader(%04X, %08X, %u);\n",
1293 hWaveOut
, lpWaveOutHdr
, uSize
);
1294 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveOut
);
1295 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1296 return wodMessage(0, WODM_PREPARE
, lpDesc
->dwInstance
,
1297 (DWORD
)lpWaveOutHdr
, uSize
);
1300 /**************************************************************************
1301 * waveOutUnprepareHeader [MMSYSTEM.407]
1303 UINT WINAPI
waveOutUnprepareHeader(HWAVEOUT hWaveOut
,
1304 WAVEHDR FAR
* lpWaveOutHdr
, UINT uSize
)
1306 LPWAVEOPENDESC lpDesc
;
1307 printf("waveOutUnprepareHeader(%04X, %08X, %u);\n",
1308 hWaveOut
, lpWaveOutHdr
, uSize
);
1309 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveOut
);
1310 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1311 return wodMessage(0, WODM_PREPARE
, lpDesc
->dwInstance
,
1312 (DWORD
)lpWaveOutHdr
, uSize
);
1315 /**************************************************************************
1316 * waveOutWrite [MMSYSTEM.408]
1318 UINT WINAPI
waveOutWrite(HWAVEOUT hWaveOut
, WAVEHDR FAR
* lpWaveOutHdr
, UINT uSize
)
1320 LPWAVEOPENDESC lpDesc
;
1321 printf("waveOutWrite(%04X, %08X, %u);\n", hWaveOut
, lpWaveOutHdr
, uSize
);
1322 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveOut
);
1323 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1324 return wodMessage(0, WODM_WRITE
, lpDesc
->dwInstance
,
1325 (DWORD
)lpWaveOutHdr
, uSize
);
1328 /**************************************************************************
1329 * waveOutPause [MMSYSTEM.409]
1331 UINT WINAPI
waveOutPause(HWAVEOUT hWaveOut
)
1333 printf("waveOutPause(%04X)\n", hWaveOut
);
1334 return MMSYSERR_INVALHANDLE
;
1337 /**************************************************************************
1338 * waveOutRestart [MMSYSTEM.410]
1340 UINT WINAPI
waveOutRestart(HWAVEOUT hWaveOut
)
1342 printf("waveOutRestart(%04X)\n", hWaveOut
);
1343 return MMSYSERR_INVALHANDLE
;
1346 /**************************************************************************
1347 * waveOutReset [MMSYSTEM.411]
1349 UINT WINAPI
waveOutReset(HWAVEOUT hWaveOut
)
1351 printf("waveOutReset(%04X)\n", hWaveOut
);
1352 return MMSYSERR_INVALHANDLE
;
1355 /**************************************************************************
1356 * waveOutGetPosition [MMSYSTEM.412]
1358 UINT WINAPI
waveOutGetPosition(HWAVEOUT hWaveOut
, MMTIME FAR
* lpTime
, UINT uSize
)
1360 LPWAVEOPENDESC lpDesc
;
1361 printf("waveOutGetPosition(%04X, %08X, %u);\n", hWaveOut
, lpTime
, uSize
);
1362 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveOut
);
1363 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1364 return wodMessage(0, WODM_GETPOS
, lpDesc
->dwInstance
,
1365 (DWORD
)lpTime
, (DWORD
)uSize
);
1368 /**************************************************************************
1369 * waveOutGetPitch [MMSYSTEM.413]
1371 UINT WINAPI
waveOutGetPitch(HWAVEOUT hWaveOut
, DWORD FAR
* lpdwPitch
)
1373 printf("waveOutGetPitch\n");
1374 return MMSYSERR_INVALHANDLE
;
1377 /**************************************************************************
1378 * waveOutSetPitch [MMSYSTEM.414]
1380 UINT WINAPI
waveOutSetPitch(HWAVEOUT hWaveOut
, DWORD dwPitch
)
1382 printf("waveOutSetPitch\n");
1383 return MMSYSERR_INVALHANDLE
;
1386 /**************************************************************************
1387 * waveOutGetVolume [MMSYSTEM.415]
1389 UINT WINAPI
waveOutGetVolume(UINT uDeviceID
, DWORD FAR
* lpdwVolume
)
1391 printf("waveOutGetVolume\n");
1392 return MMSYSERR_INVALHANDLE
;
1395 /**************************************************************************
1396 * waveOutSetVolume [MMSYSTEM.416]
1398 UINT WINAPI
waveOutSetVolume(UINT uDeviceID
, DWORD dwVolume
)
1400 printf("waveOutSetVolume\n");
1401 return MMSYSERR_INVALHANDLE
;
1404 /**************************************************************************
1405 * waveOutGetPlaybackRate [MMSYSTEM.417]
1407 UINT WINAPI
waveOutGetPlaybackRate(HWAVEOUT hWaveOut
, DWORD FAR
* lpdwRate
)
1409 printf("waveOutGetPlaybackRate\n");
1410 return MMSYSERR_INVALHANDLE
;
1413 /**************************************************************************
1414 * waveOutSetPlaybackRate [MMSYSTEM.418]
1416 UINT WINAPI
waveOutSetPlaybackRate(HWAVEOUT hWaveOut
, DWORD dwRate
)
1418 printf("waveOutSetPlaybackRate\n");
1419 return MMSYSERR_INVALHANDLE
;
1422 /**************************************************************************
1423 * waveOutBreakLoop [MMSYSTEM.419]
1425 UINT WINAPI
waveOutBreakLoop(HWAVEOUT hWaveOut
)
1427 printf("waveOutBreakLoop(%04X)\n", hWaveOut
);
1428 return MMSYSERR_INVALHANDLE
;
1431 /**************************************************************************
1432 * waveOutGetID [MMSYSTEM.420]
1434 UINT WINAPI
waveOutGetID(HWAVEOUT hWaveOut
, UINT FAR
* lpuDeviceID
)
1436 printf("waveOutGetID\n");
1437 return MMSYSERR_INVALHANDLE
;
1440 /**************************************************************************
1441 * waveOutMessage [MMSYSTEM.421]
1443 DWORD WINAPI
waveOutMessage(HWAVEOUT hWaveOut
, UINT uMessage
,
1444 DWORD dwParam1
, DWORD dwParam2
)
1448 /**************************************************************************
1449 * waveInGetNumDevs [MMSYSTEM.501]
1451 UINT WINAPI
waveInGetNumDevs()
1454 printf("waveInGetNumDevs\n");
1455 count
+= widMessage(0, WIDM_GETNUMDEVS
, 0L, 0L, 0L);
1456 printf("waveInGetNumDevs return %u \n", count
);
1461 /**************************************************************************
1462 * waveInGetDevCaps [MMSYSTEM.502]
1464 UINT WINAPI
waveInGetDevCaps(UINT uDeviceID
, WAVEINCAPS FAR
* lpCaps
, UINT uSize
)
1466 printf("waveInGetDevCaps\n");
1467 return widMessage(uDeviceID
, WIDM_GETDEVCAPS
, 0L, (DWORD
)lpCaps
, uSize
);
1471 /**************************************************************************
1472 * waveInGetErrorText [MMSYSTEM.503]
1474 UINT WINAPI
waveInGetErrorText(UINT uError
, LPSTR lpText
, UINT uSize
)
1476 printf("waveInGetErrorText\n");
1477 return(waveGetErrorText(uError
, lpText
, uSize
));
1481 /**************************************************************************
1482 * waveInOpen [MMSYSTEM.504]
1484 UINT WINAPI
waveInOpen(HWAVEIN FAR
* lphWaveIn
, UINT uDeviceID
,
1485 const LPWAVEFORMAT lpFormat
, DWORD dwCallback
, DWORD dwInstance
, DWORD dwFlags
)
1488 LPWAVEOPENDESC lpDesc
;
1490 BOOL bMapperFlg
= FALSE
;
1491 printf("waveInOpen(%08X, %d, %08X, %08X, %08X, %08X);\n",
1492 lphWaveIn
, uDeviceID
, lpFormat
, dwCallback
, dwInstance
, dwFlags
);
1493 if (dwFlags
& WAVE_FORMAT_QUERY
) {
1494 printf("waveInOpen // WAVE_FORMAT_QUERY requested !\n");
1496 if (uDeviceID
== (UINT
)WAVE_MAPPER
) {
1497 printf("waveInOpen // WAVE_MAPPER mode requested !\n");
1501 if (lpFormat
== NULL
) return WAVERR_BADFORMAT
;
1502 hWaveIn
= GlobalAlloc(GMEM_MOVEABLE
, sizeof(WAVEOPENDESC
));
1503 if (lphWaveIn
!= NULL
) *lphWaveIn
= hWaveIn
;
1504 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveIn
);
1505 if (lpDesc
== NULL
) return MMSYSERR_NOMEM
;
1506 lpDesc
->hWave
= hWaveIn
;
1507 lpDesc
->lpFormat
= lpFormat
;
1508 lpDesc
->dwCallBack
= dwCallback
;
1509 lpDesc
->dwInstance
= dwInstance
;
1510 while(uDeviceID
< MAXWAVEDRIVERS
) {
1511 dwRet
= widMessage(uDeviceID
, WIDM_OPEN
,
1512 lpDesc
->dwInstance
, (DWORD
)lpDesc
, 0L);
1513 if (dwRet
== MMSYSERR_NOERROR
) break;
1514 if (!bMapperFlg
) break;
1516 printf("waveInOpen // WAVE_MAPPER mode ! try next driver...\n");
1518 if (dwFlags
& WAVE_FORMAT_QUERY
) {
1519 printf("waveInOpen // End of WAVE_FORMAT_QUERY !\n");
1520 waveInClose(hWaveIn
);
1526 /**************************************************************************
1527 * waveInClose [MMSYSTEM.505]
1529 UINT WINAPI
waveInClose(HWAVEIN hWaveIn
)
1531 LPWAVEOPENDESC lpDesc
;
1532 printf("waveInClose(%04X)\n", hWaveIn
);
1533 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveIn
);
1534 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1535 return widMessage(0, WIDM_CLOSE
, lpDesc
->dwInstance
, 0L, 0L);
1539 /**************************************************************************
1540 * waveInPrepareHeader [MMSYSTEM.506]
1542 UINT WINAPI
waveInPrepareHeader(HWAVEIN hWaveIn
,
1543 WAVEHDR FAR
* lpWaveInHdr
, UINT uSize
)
1545 LPWAVEOPENDESC lpDesc
;
1546 printf("waveInPrepareHeader(%04X, %08X, %u);\n",
1547 hWaveIn
, lpWaveInHdr
, uSize
);
1548 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveIn
);
1549 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1550 if (lpWaveInHdr
== NULL
) return MMSYSERR_INVALHANDLE
;
1551 lpWaveInHdr
->lpNext
= NULL
;
1552 lpWaveInHdr
->dwBytesRecorded
= 0;
1553 printf("waveInPrepareHeader // lpData=%08X size=%u \n",
1554 lpWaveInHdr
->lpData
, lpWaveInHdr
->dwBufferLength
);
1555 return widMessage(0, WIDM_PREPARE
, lpDesc
->dwInstance
,
1556 (DWORD
)lpWaveInHdr
, uSize
);
1560 /**************************************************************************
1561 * waveInUnprepareHeader [MMSYSTEM.507]
1563 UINT WINAPI
waveInUnprepareHeader(HWAVEIN hWaveIn
,
1564 WAVEHDR FAR
* lpWaveInHdr
, UINT uSize
)
1566 LPWAVEOPENDESC lpDesc
;
1567 printf("waveInUnprepareHeader(%04X, %08X, %u);\n",
1568 hWaveIn
, lpWaveInHdr
, uSize
);
1569 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveIn
);
1570 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1571 USER_HEAP_FREE(HIWORD((DWORD
)lpWaveInHdr
->lpData
));
1572 lpWaveInHdr
->lpData
= NULL
;
1573 lpWaveInHdr
->lpNext
= NULL
;
1574 return widMessage(0, WIDM_PREPARE
, lpDesc
->dwInstance
,
1575 (DWORD
)lpWaveInHdr
, uSize
);
1579 /**************************************************************************
1580 * waveInAddBuffer [MMSYSTEM.508]
1582 UINT WINAPI
waveInAddBuffer(HWAVEIN hWaveIn
,
1583 WAVEHDR FAR
* lpWaveInHdr
, UINT uSize
)
1585 LPWAVEOPENDESC lpDesc
;
1586 printf("waveInAddBuffer(%04X, %08X, %u);\n", hWaveIn
, lpWaveInHdr
, uSize
);
1587 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveIn
);
1588 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1589 if (lpWaveInHdr
== NULL
) return MMSYSERR_INVALHANDLE
;
1590 lpWaveInHdr
->lpNext
= NULL
;
1591 lpWaveInHdr
->dwBytesRecorded
= 0;
1592 printf("waveInAddBuffer // lpData=%08X size=%u \n",
1593 lpWaveInHdr
->lpData
, lpWaveInHdr
->dwBufferLength
);
1594 return widMessage(0, WIDM_ADDBUFFER
, lpDesc
->dwInstance
,
1595 (DWORD
)lpWaveInHdr
, uSize
);
1599 /**************************************************************************
1600 * waveInStart [MMSYSTEM.509]
1602 UINT WINAPI
waveInStart(HWAVEIN hWaveIn
)
1604 LPWAVEOPENDESC lpDesc
;
1605 printf("waveInStart(%04X)\n", hWaveIn
);
1606 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveIn
);
1607 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1608 return widMessage(0, WIDM_START
, lpDesc
->dwInstance
, 0L, 0L);
1612 /**************************************************************************
1613 * waveInStop [MMSYSTEM.510]
1615 UINT WINAPI
waveInStop(HWAVEIN hWaveIn
)
1617 LPWAVEOPENDESC lpDesc
;
1618 printf("waveInStop(%04X)\n", hWaveIn
);
1619 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveIn
);
1620 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1621 return widMessage(0, WIDM_STOP
, lpDesc
->dwInstance
, 0L, 0L);
1625 /**************************************************************************
1626 * waveInReset [MMSYSTEM.511]
1628 UINT WINAPI
waveInReset(HWAVEIN hWaveIn
)
1630 LPWAVEOPENDESC lpDesc
;
1631 printf("waveInReset(%04X)\n", hWaveIn
);
1632 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveIn
);
1633 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1634 return widMessage(0, WIDM_RESET
, lpDesc
->dwInstance
, 0L, 0L);
1638 /**************************************************************************
1639 * waveInGetPosition [MMSYSTEM.512]
1641 UINT WINAPI
waveInGetPosition(HWAVEIN hWaveIn
, MMTIME FAR
* lpTime
, UINT uSize
)
1643 LPWAVEOPENDESC lpDesc
;
1644 printf("waveInGetPosition(%04X, %08X, %u);\n", hWaveIn
, lpTime
, uSize
);
1645 lpDesc
= (LPWAVEOPENDESC
) GlobalLock(hWaveIn
);
1646 if (lpDesc
== NULL
) return MMSYSERR_INVALHANDLE
;
1647 return widMessage(0, WIDM_GETPOS
, lpDesc
->dwInstance
,
1648 (DWORD
)lpTime
, (DWORD
)uSize
);
1652 /**************************************************************************
1653 * waveInGetID [MMSYSTEM.513]
1655 UINT WINAPI
waveInGetID(HWAVEIN hWaveIn
, UINT FAR
* lpuDeviceID
)
1657 printf("waveInGetID\n");
1658 if (lpuDeviceID
== NULL
) return MMSYSERR_INVALPARAM
;
1663 /**************************************************************************
1664 * waveInMessage [MMSYSTEM.514]
1666 DWORD WINAPI
waveInMessage(HWAVEIN hWaveIn
, UINT uMessage
,
1667 DWORD dwParam1
, DWORD dwParam2
)
1672 /**************************************************************************
1673 * MMSysTimeCallback [internal]
1675 WORD FAR PASCAL
MMSysTimeCallback(HWND hWnd
, WORD wMsg
, int nID
, DWORD dwTime
)
1677 LPTIMERENTRY lpTimer
= lpTimerList
;
1678 mmSysTimeMS
.u
.ms
+= 33;
1679 mmSysTimeSMPTE
.u
.smpte
.frame
++;
1680 while (lpTimer
!= NULL
) {
1681 lpTimer
->wCurTime
--;
1682 if (lpTimer
->wCurTime
== 0) {
1683 lpTimer
->wCurTime
= lpTimer
->wDelay
;
1684 if (lpTimer
->lpFunc
!= NULL
) {
1686 printf("MMSysTimeCallback // before CallBack16 !\n");
1690 (*lpTimer
->lpFunc
)(lpTimer
->wTimerID
, (WORD
)0,
1691 lpTimer
->dwUser
, (DWORD
)0, (DWORD
)0);
1693 CallBack16(lpTimer
->lpFunc
, 5,
1694 0, (int)lpTimer
->wTimerID
, 0, (int)0,
1695 2, lpTimer
->dwUser
, 2, 0, 2, 0);
1698 printf("MMSysTimeCallback // after CallBack16 !\n");
1702 if (lpTimer
->wFlags
& TIME_ONESHOT
)
1703 timeKillEvent(lpTimer
->wTimerID
);
1705 lpTimer
= lpTimer
->Next
;
1710 /**************************************************************************
1711 * StartMMTime [internal]
1715 if (!mmTimeStarted
) {
1716 mmTimeStarted
= TRUE
;
1717 mmSysTimeMS
.wType
= TIME_MS
;
1718 mmSysTimeMS
.u
.ms
= 0;
1719 mmSysTimeSMPTE
.wType
= TIME_SMPTE
;
1720 mmSysTimeSMPTE
.u
.smpte
.hour
= 0;
1721 mmSysTimeSMPTE
.u
.smpte
.min
= 0;
1722 mmSysTimeSMPTE
.u
.smpte
.sec
= 0;
1723 mmSysTimeSMPTE
.u
.smpte
.frame
= 0;
1724 mmSysTimeSMPTE
.u
.smpte
.fps
= 0;
1725 mmSysTimeSMPTE
.u
.smpte
.dummy
= 0;
1726 SetTimer(0, 1, 33, (FARPROC
)MMSysTimeCallback
);
1730 /**************************************************************************
1731 * timeGetSystemTime [MMSYSTEM.601]
1733 WORD
timeGetSystemTime(LPMMTIME lpTime
, WORD wSize
)
1735 printf("timeGetSystemTime(%08X, %u);\n", lpTime
, wSize
);
1736 if (!mmTimeStarted
) StartMMTime();
1740 /**************************************************************************
1741 * timeSetEvent [MMSYSTEM.602]
1743 WORD
timeSetEvent(WORD wDelay
, WORD wResol
,
1744 LPTIMECALLBACK lpFunc
,
1745 DWORD dwUser
, WORD wFlags
)
1748 LPTIMERENTRY lpNewTimer
;
1749 LPTIMERENTRY lpTimer
= lpTimerList
;
1750 printf("timeSetEvent(%u, %u, %08X, %08X, %04X);\n",
1751 wDelay
, wResol
, lpFunc
, dwUser
, wFlags
);
1752 if (!mmTimeStarted
) StartMMTime();
1753 lpNewTimer
= (LPTIMERENTRY
) malloc(sizeof(TIMERENTRY
));
1754 if (lpNewTimer
== NULL
) return 0;
1755 while (lpTimer
!= NULL
) {
1756 wNewID
= max(wNewID
, lpTimer
->wTimerID
);
1757 if (lpTimer
->Next
== NULL
) break;
1758 lpTimer
= lpTimer
->Next
;
1760 if (lpTimerList
== NULL
) {
1761 lpTimerList
= lpNewTimer
;
1762 lpNewTimer
->Prev
== NULL
;
1765 lpTimer
->Next
== lpNewTimer
;
1766 lpNewTimer
->Prev
== lpTimer
;
1768 lpNewTimer
->Next
= NULL
;
1769 lpNewTimer
->wTimerID
= wNewID
+ 1;
1770 lpNewTimer
->wCurTime
= wDelay
;
1771 lpNewTimer
->wDelay
= wDelay
;
1772 lpNewTimer
->wResol
= wResol
;
1773 lpNewTimer
->lpFunc
= (FARPROC
)lpFunc
;
1774 lpNewTimer
->dwUser
= dwUser
;
1775 lpNewTimer
->wFlags
= wFlags
;
1776 return lpNewTimer
->wTimerID
;
1779 /**************************************************************************
1780 * timeKillEvent [MMSYSTEM.603]
1782 WORD
timeKillEvent(WORD wID
)
1784 LPTIMERENTRY lpTimer
= lpTimerList
;
1785 while (lpTimer
!= NULL
) {
1786 if (wID
== lpTimer
->wTimerID
) {
1787 if (lpTimer
->Prev
!= NULL
) lpTimer
->Prev
->Next
= lpTimer
->Next
;
1788 if (lpTimer
->Next
!= NULL
) lpTimer
->Next
->Prev
= lpTimer
->Prev
;
1792 lpTimer
= lpTimer
->Next
;
1797 /**************************************************************************
1798 * timeGetDevCaps [MMSYSTEM.604]
1800 WORD
timeGetDevCaps(LPTIMECAPS lpCaps
, WORD wSize
)
1802 printf("timeGetDevCaps(%08X, %u) !\n", lpCaps
, wSize
);
1806 /**************************************************************************
1807 * timeBeginPeriod [MMSYSTEM.605]
1809 WORD
timeBeginPeriod(WORD wPeriod
)
1811 printf("timeBeginPeriod(%u) !\n", wPeriod
);
1812 if (!mmTimeStarted
) StartMMTime();
1816 /**************************************************************************
1817 * timeEndPeriod [MMSYSTEM.606]
1819 WORD
timeEndPeriod(WORD wPeriod
)
1821 printf("timeEndPeriod(%u) !\n", wPeriod
);
1825 /**************************************************************************
1826 * timeGetTime [MMSYSTEM.607]
1830 printf("timeGetTime(); !\n");
1831 if (!mmTimeStarted
) StartMMTime();
1836 /**************************************************************************
1837 * mmioOpen [MMSYSTEM.1210]
1839 HMMIO WINAPI
mmioOpen(LPSTR szFileName
, MMIOINFO FAR
* lpmmioinfo
, DWORD dwOpenFlags
)
1844 LPMMIOINFO lpmminfo
;
1845 printf("mmioOpen('%s', %08X, %08X);\n", szFileName
, lpmmioinfo
, dwOpenFlags
);
1846 hFile
= OpenFile(szFileName
, &ofs
, dwOpenFlags
);
1847 if (hFile
== -1) return 0;
1848 hmmio
= GlobalAlloc(GMEM_MOVEABLE
, sizeof(MMIOINFO
));
1849 lpmminfo
= (LPMMIOINFO
)GlobalLock(hmmio
);
1850 if (lpmminfo
== NULL
) return 0;
1851 memset(lpmminfo
, 0, sizeof(MMIOINFO
));
1852 lpmminfo
->hmmio
= hmmio
;
1853 lpmminfo
->dwReserved2
= MAKELONG(hFile
, 0);
1854 GlobalUnlock(hmmio
);
1855 return (HMMIO
)hmmio
;
1860 /**************************************************************************
1861 * mmioClose [MMSYSTEM.1211]
1863 UINT WINAPI
mmioClose(HMMIO hmmio
, UINT uFlags
)
1865 LPMMIOINFO lpmminfo
;
1866 printf("mmioClose(%04X, %04X);\n", hmmio
, uFlags
);
1867 lpmminfo
= (LPMMIOINFO
)GlobalLock(hmmio
);
1868 if (lpmminfo
== NULL
) return 0;
1869 _lclose(LOWORD(lpmminfo
->dwReserved2
));
1870 GlobalUnlock(hmmio
);
1877 /**************************************************************************
1878 * mmioRead [MMSYSTEM.1212]
1880 LONG WINAPI
mmioRead(HMMIO hmmio
, HPSTR pch
, LONG cch
)
1883 LPMMIOINFO lpmminfo
;
1885 printf("mmioRead(%04X, %08X, %ld);\n", hmmio
, pch
, cch
);
1887 lpmminfo
= (LPMMIOINFO
)GlobalLock(hmmio
);
1888 if (lpmminfo
== NULL
) return 0;
1889 count
= _lread(LOWORD(lpmminfo
->dwReserved2
), pch
, cch
);
1890 GlobalUnlock(hmmio
);
1896 /**************************************************************************
1897 * mmioWrite [MMSYSTEM.1213]
1899 LONG WINAPI
mmioWrite(HMMIO hmmio
, HPCSTR pch
, LONG cch
)
1902 LPMMIOINFO lpmminfo
;
1903 printf("mmioWrite(%04X, %08X, %ld);\n", hmmio
, pch
, cch
);
1904 lpmminfo
= (LPMMIOINFO
)GlobalLock(hmmio
);
1905 if (lpmminfo
== NULL
) return 0;
1906 count
= _lwrite(LOWORD(lpmminfo
->dwReserved2
), (LPSTR
)pch
, cch
);
1907 GlobalUnlock(hmmio
);
1911 /**************************************************************************
1912 * mmioSeek [MMSYSTEM.1214]
1914 LONG WINAPI
mmioSeek(HMMIO hmmio
, LONG lOffset
, int iOrigin
)
1917 LPMMIOINFO lpmminfo
;
1918 printf("mmioSeek(%04X, %08X, %d);\n", hmmio
, lOffset
, iOrigin
);
1919 lpmminfo
= (LPMMIOINFO
)GlobalLock(hmmio
);
1920 if (lpmminfo
== NULL
) return 0;
1921 count
= _llseek(LOWORD(lpmminfo
->dwReserved2
), lOffset
, iOrigin
);
1922 GlobalUnlock(hmmio
);
1926 /**************************************************************************
1927 * mmioGetInfo [MMSYSTEM.1215]
1929 UINT WINAPI
mmioGetInfo(HMMIO hmmio
, MMIOINFO FAR
* lpmmioinfo
, UINT uFlags
)
1931 LPMMIOINFO lpmminfo
;
1932 printf("mmioGetInfo\n");
1933 lpmminfo
= (LPMMIOINFO
)GlobalLock(hmmio
);
1934 if (lpmminfo
== NULL
) return 0;
1935 memcpy(lpmmioinfo
, lpmminfo
, sizeof(MMIOINFO
));
1936 GlobalUnlock(hmmio
);
1940 /**************************************************************************
1941 * mmioSetInfo [MMSYSTEM.1216]
1943 UINT WINAPI
mmioSetInfo(HMMIO hmmio
, const MMIOINFO FAR
* lpmmioinfo
, UINT uFlags
)
1945 LPMMIOINFO lpmminfo
;
1946 printf("mmioSetInfo\n");
1947 lpmminfo
= (LPMMIOINFO
)GlobalLock(hmmio
);
1948 if (lpmminfo
== NULL
) return 0;
1949 GlobalUnlock(hmmio
);
1953 /**************************************************************************
1954 * mmioSetBuffer [MMSYSTEM.1217]
1956 UINT WINAPI
mmioSetBuffer(HMMIO hmmio
, LPSTR pchBuffer
,
1957 LONG cchBuffer
, UINT uFlags
)
1959 printf("mmioSetBuffer\n");
1963 /**************************************************************************
1964 * mmioFlush [MMSYSTEM.1218]
1966 UINT WINAPI
mmioFlush(HMMIO hmmio
, UINT uFlags
)
1968 LPMMIOINFO lpmminfo
;
1969 printf("mmioFlush(%04X, %04X)\n", hmmio
, uFlags
);
1970 lpmminfo
= (LPMMIOINFO
)GlobalLock(hmmio
);
1971 if (lpmminfo
== NULL
) return 0;
1972 GlobalUnlock(hmmio
);
1976 /**************************************************************************
1977 * mmioAdvance [MMSYSTEM.1219]
1979 UINT WINAPI
mmioAdvance(HMMIO hmmio
, MMIOINFO FAR
* lpmmioinfo
, UINT uFlags
)
1982 LPMMIOINFO lpmminfo
;
1983 printf("mmioAdvance\n");
1984 lpmminfo
= (LPMMIOINFO
)GlobalLock(hmmio
);
1985 if (lpmminfo
== NULL
) return 0;
1986 if (uFlags
== MMIO_READ
) {
1987 count
= _lread(LOWORD(lpmminfo
->dwReserved2
),
1988 lpmmioinfo
->pchBuffer
, lpmmioinfo
->cchBuffer
);
1990 if (uFlags
== MMIO_WRITE
) {
1991 count
= _lwrite(LOWORD(lpmminfo
->dwReserved2
),
1992 lpmmioinfo
->pchBuffer
, lpmmioinfo
->cchBuffer
);
1994 lpmmioinfo
->pchNext
+= count
;
1995 GlobalUnlock(hmmio
);
1996 lpmminfo
->lDiskOffset
= _llseek(LOWORD(lpmminfo
->dwReserved2
), 0, SEEK_CUR
);
2000 /**************************************************************************
2001 * mmioStringToFOURCC [MMSYSTEM.1220]
2003 FOURCC WINAPI
mmioStringToFOURCC(LPCSTR sz
, UINT uFlags
)
2005 printf("mmioStringToFOURCC\n");
2009 /**************************************************************************
2010 * mmioInstallIOProc [MMSYSTEM.1221]
2012 LPMMIOPROC WINAPI
mmioInstallIOProc(FOURCC fccIOProc
,
2013 LPMMIOPROC pIOProc
, DWORD dwFlags
)
2015 printf("mmioInstallIOProc\n");
2019 /**************************************************************************
2020 * mmioSendMessage [MMSYSTEM.1222]
2022 LRESULT WINAPI
mmioSendMessage(HMMIO hmmio
, UINT uMessage
,
2023 LPARAM lParam1
, LPARAM lParam2
)
2025 printf("mmioSendMessage\n");
2029 /**************************************************************************
2030 * mmioDescend [MMSYSTEM.1223]
2032 UINT WINAPI
mmioDescend(HMMIO hmmio
, MMCKINFO FAR
* lpck
,
2033 const MMCKINFO FAR
* lpckParent
, UINT uFlags
)
2035 DWORD dwfcc
, dwOldPos
;
2036 LPMMIOINFO lpmminfo
;
2038 printf("mmioDescend(%04X, %08X, %08X, %04X);\n",
2039 hmmio
, lpck
, lpckParent
, uFlags
);
2041 if (lpck
== NULL
) return 0;
2042 lpmminfo
= (LPMMIOINFO
)GlobalLock(hmmio
);
2043 if (lpmminfo
== NULL
) return 0;
2045 dwOldPos
= _llseek(LOWORD(lpmminfo
->dwReserved2
), 0, SEEK_CUR
);
2046 if (lpckParent
!= NULL
) {
2048 printf("mmioDescend // seek inside parent at %ld !\n", lpckParent
->dwDataOffset
);
2050 dwOldPos
= _llseek(LOWORD(lpmminfo
->dwReserved2
),
2051 lpckParent
->dwDataOffset
, SEEK_SET
);
2053 if ((uFlags
& MMIO_FINDCHUNK
) || (uFlags
& MMIO_FINDRIFF
) ||
2054 (uFlags
& MMIO_FINDLIST
)) {
2056 printf("mmioDescend // MMIO_FINDxxxx dwfcc=%08X !\n", dwfcc
);
2059 if (_lread(LOWORD(lpmminfo
->dwReserved2
), (LPSTR
)lpck
,
2060 sizeof(MMCKINFO
)) < sizeof(MMCKINFO
)) {
2061 _llseek(LOWORD(lpmminfo
->dwReserved2
), dwOldPos
, SEEK_SET
);
2062 GlobalUnlock(hmmio
);
2063 return MMIOERR_CHUNKNOTFOUND
;
2066 printf("mmioDescend // dwfcc=%08X ckid=%08X cksize=%08X !\n",
2067 dwfcc
, lpck
->ckid
, lpck
->cksize
);
2069 if (dwfcc
== lpck
->ckid
) break;
2070 dwOldPos
+= lpck
->cksize
+ 2 * sizeof(DWORD
);
2071 if (lpck
->ckid
== FOURCC_RIFF
|| lpck
->ckid
== FOURCC_LIST
)
2072 dwOldPos
+= sizeof(DWORD
);
2073 _llseek(LOWORD(lpmminfo
->dwReserved2
), dwOldPos
, SEEK_SET
);
2077 if (_lread(LOWORD(lpmminfo
->dwReserved2
), (LPSTR
)lpck
,
2078 sizeof(MMCKINFO
)) < sizeof(MMCKINFO
)) {
2079 _llseek(LOWORD(lpmminfo
->dwReserved2
), dwOldPos
, SEEK_SET
);
2080 GlobalUnlock(hmmio
);
2081 return MMIOERR_CHUNKNOTFOUND
;
2084 GlobalUnlock(hmmio
);
2085 lpck
->dwDataOffset
= dwOldPos
+ 2 * sizeof(DWORD
);
2086 if (lpck
->ckid
== FOURCC_RIFF
|| lpck
->ckid
== FOURCC_LIST
)
2087 lpck
->dwDataOffset
+= sizeof(DWORD
);
2088 lpmminfo
->lDiskOffset
= _llseek(LOWORD(lpmminfo
->dwReserved2
),
2089 lpck
->dwDataOffset
, SEEK_SET
);
2091 printf("mmioDescend // lpck->ckid=%08X lpck->cksize=%ld !\n",
2092 lpck
->ckid
, lpck
->cksize
);
2093 printf("mmioDescend // lpck->fccType=%08X !\n", lpck
->fccType
);
2098 /**************************************************************************
2099 * mmioAscend [MMSYSTEM.1224]
2101 UINT WINAPI
mmioAscend(HMMIO hmmio
, MMCKINFO FAR
* lpck
, UINT uFlags
)
2103 printf("mmioAscend\n");
2107 /**************************************************************************
2108 * mmioCreateChunk [MMSYSTEM.1225]
2110 UINT WINAPI
mmioCreateChunk(HMMIO hmmio
, MMCKINFO FAR
* lpck
, UINT uFlags
)
2112 printf("mmioCreateChunk\n");
2117 /**************************************************************************
2118 * mmioRename [MMSYSTEM.1226]
2120 UINT WINAPI
mmioRename(LPCSTR szFileName
, LPCSTR szNewFileName
,
2121 MMIOINFO FAR
* lpmmioinfo
, DWORD dwRenameFlags
)
2123 printf("mmioRename('%s', '%s', %08X, %08X);\n",
2124 szFileName
, szNewFileName
, lpmmioinfo
, dwRenameFlags
);
2128 /**************************************************************************
2129 * DrvOpen [MMSYSTEM.1100]
2131 HDRVR
DrvOpen(LPSTR lpDriverName
, LPSTR lpSectionName
, LPARAM lParam
)
2133 printf("DrvOpen('%s', '%s', %08X);\n",
2134 lpDriverName
, lpSectionName
, lParam
);
2135 return OpenDriver(lpDriverName
, lpSectionName
, lParam
);
2139 /**************************************************************************
2140 * DrvClose [MMSYSTEM.1101]
2142 LRESULT
DrvClose(HDRVR hDrvr
, LPARAM lParam1
, LPARAM lParam2
)
2144 printf("DrvClose(%04X, %08X, %08X);\n", hDrvr
, lParam1
, lParam2
);
2145 return CloseDriver(hDrvr
, lParam1
, lParam2
);
2149 /**************************************************************************
2150 * DrvSendMessage [MMSYSTEM.1102]
2152 LRESULT WINAPI
DrvSendMessage(HDRVR hDriver
, WORD msg
, LPARAM lParam1
, LPARAM lParam2
)
2155 printf("DrvSendMessage(%04X, %04X, %08X, %08X);\n",
2156 hDriver
, msg
, lParam1
, lParam2
);
2158 return CDAUDIO_DriverProc(dwDevID
, hDriver
, msg
, lParam1
, lParam2
);
2162 /**************************************************************************
2163 * DrvGetModuleHandle [MMSYSTEM.1103]
2165 HANDLE
DrvGetModuleHandle(HDRVR hDrvr
)
2167 printf("DrvGetModuleHandle(%04X);\n", hDrvr
);
2171 /**************************************************************************
2172 * DrvDefDriverProc [MMSYSTEM.1104]
2174 LRESULT
DrvDefDriverProc(DWORD dwDevID
, HDRVR hDriv
, WORD wMsg
,
2175 DWORD dwParam1
, DWORD dwParam2
)
2177 return DefDriverProc(dwDevID
, hDriv
, wMsg
, dwParam1
, dwParam2
);
2181 #endif /* #ifdef WINELIB */