Release 951212
[wine/gsoc-2012-control.git] / multimedia / mmsystem.c
blob152ee9a1c434c738c7d265e9fe5614144efe892b
1 /*
2 * MMSYTEM functions
4 * Copyright 1993 Martin Ayotte
5 */
6 /* FIXME: I think there are some segmented vs. linear pointer weirdnesses
7 * and long term pointers to 16 bit space in here
8 */
10 #ifndef WINELIB
12 #include <unistd.h>
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <string.h>
16 #include <fcntl.h>
17 #include <sys/ioctl.h>
18 #include "windows.h"
19 #include "ldt.h"
20 #include "callback.h"
21 #include "user.h"
22 #include "driver.h"
23 #include "mmsystem.h"
24 #include "stddebug.h"
25 #include "debug.h"
26 #include "xmalloc.h"
28 static int InstalledCount;
29 static int InstalledListLen;
30 static LPSTR lpInstallNames = NULL;
32 MCI_OPEN_DRIVER_PARMS mciDrv[MAXMCIDRIVERS];
34 UINT midiGetErrorText(UINT uError, LPSTR lpText, UINT uSize);
35 UINT waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize);
36 LONG DrvDefDriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
37 DWORD dwParam1, DWORD dwParam2);
39 LONG WAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
40 DWORD dwParam1, DWORD dwParam2);
41 LONG MIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
42 DWORD dwParam1, DWORD dwParam2);
43 LONG CDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
44 DWORD dwParam1, DWORD dwParam2);
45 LONG ANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
46 DWORD dwParam1, DWORD dwParam2);
48 /**************************************************************************
49 * MMSYSTEM_WEP [MMSYSTEM.1]
51 int MMSYSTEM_WEP(HANDLE hInstance, WORD wDataSeg,
52 WORD cbHeapSize, LPSTR lpCmdLine)
54 /* isn't WEP the Windows Exit Procedure ? */
55 printf("MMSYSTEM DLL INIT ... hInst=%04X \n", hInstance);
56 return(TRUE);
59 /**************************************************************************
60 * sndPlaySound [MMSYSTEM.2]
62 BOOL sndPlaySound(LPCSTR lpszSoundName, UINT uFlags)
64 HMMIO hmmio;
65 MMCKINFO mmckInfo;
66 MMCKINFO ckMainRIFF;
67 HANDLE hFormat;
68 PCMWAVEFORMAT pcmWaveFormat;
69 int count;
70 int bufsize;
71 HANDLE hDesc;
72 LPWAVEOPENDESC lpWaveDesc;
73 HANDLE hWaveHdr;
74 LPWAVEHDR lpWaveHdr;
75 LPWAVEHDR lp16WaveHdr;
76 HANDLE hData;
77 DWORD dwRet;
78 char str[128];
79 LPSTR ptr;
80 dprintf_mmsys(stddeb, "sndPlaySound // SoundName='%s' uFlags=%04X !\n",
81 lpszSoundName, uFlags);
82 if (lpszSoundName == NULL) {
83 dprintf_mmsys(stddeb, "sndPlaySound // Stop !\n");
84 return FALSE;
86 hmmio = mmioOpen((LPSTR)lpszSoundName, NULL,
87 MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
88 if (hmmio == 0) {
89 dprintf_mmsys(stddeb, "sndPlaySound // searching in SystemSound List !\n");
90 GetProfileString("Sounds", (LPSTR)lpszSoundName, "", str, sizeof(str));
91 if (strlen(str) == 0) return FALSE;
92 if ( (ptr = (LPSTR)strchr(str, ',')) != NULL) *ptr = '\0';
93 hmmio = mmioOpen(str, NULL, MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
94 if (hmmio == 0) {
95 dprintf_mmsys(stddeb, "sndPlaySound // can't find SystemSound='%s' !\n", str);
96 return FALSE;
99 if (mmioDescend(hmmio, &ckMainRIFF, NULL, 0) != 0) {
100 ErrSND: if (hmmio != 0) mmioClose(hmmio, 0);
101 return FALSE;
103 dprintf_mmsys(stddeb, "sndPlaySound // ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
104 (LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType,
105 ckMainRIFF.cksize);
106 if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
107 (ckMainRIFF.fccType != mmioFOURCC('W', 'A', 'V', 'E'))) goto ErrSND;
108 mmckInfo.ckid = mmioFOURCC('f', 'm', 't', ' ');
109 if (mmioDescend(hmmio, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) != 0) goto ErrSND;
110 dprintf_mmsys(stddeb, "sndPlaySound // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
111 (LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType,
112 mmckInfo.cksize);
113 if (mmioRead(hmmio, (HPSTR) &pcmWaveFormat,
114 (long) sizeof(PCMWAVEFORMAT)) != (long) sizeof(PCMWAVEFORMAT)) goto ErrSND;
116 dprintf_mmsys(stddeb, "sndPlaySound // wFormatTag=%04X !\n", pcmWaveFormat.wf.wFormatTag);
117 dprintf_mmsys(stddeb, "sndPlaySound // nChannels=%d \n", pcmWaveFormat.wf.nChannels);
118 dprintf_mmsys(stddeb, "sndPlaySound // nSamplesPerSec=%ld\n", pcmWaveFormat.wf.nSamplesPerSec);
119 dprintf_mmsys(stddeb, "sndPlaySound // nAvgBytesPerSec=%ld\n", pcmWaveFormat.wf.nAvgBytesPerSec);
120 dprintf_mmsys(stddeb, "sndPlaySound // nBlockAlign=%d \n", pcmWaveFormat.wf.nBlockAlign);
121 dprintf_mmsys(stddeb, "sndPlaySound // wBitsPerSample=%u !\n", pcmWaveFormat.wBitsPerSample);
123 mmckInfo.ckid = mmioFOURCC('d', 'a', 't', 'a');
124 if (mmioDescend(hmmio, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) != 0) goto ErrSND;
125 dprintf_mmsys(stddeb, "sndPlaySound // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
126 (LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType,
127 mmckInfo.cksize);
128 hDesc = USER_HEAP_ALLOC(sizeof(WAVEOPENDESC));
129 lpWaveDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hDesc);
130 lpWaveDesc->hWave = 0;
131 pcmWaveFormat.wf.nAvgBytesPerSec =
132 pcmWaveFormat.wf.nSamplesPerSec * pcmWaveFormat.wf.nBlockAlign;
133 hFormat = USER_HEAP_ALLOC(sizeof(PCMWAVEFORMAT));
134 lpWaveDesc->lpFormat = (LPWAVEFORMAT) USER_HEAP_LIN_ADDR(hFormat);
135 memcpy(lpWaveDesc->lpFormat, &pcmWaveFormat, sizeof(PCMWAVEFORMAT));
136 lpWaveDesc = (LPWAVEOPENDESC) USER_HEAP_SEG_ADDR(hDesc);
137 dwRet = wodMessage(0, WODM_OPEN, 0, (DWORD)lpWaveDesc, CALLBACK_NULL);
138 if (dwRet != MMSYSERR_NOERROR) {
139 dprintf_mmsys(stddeb, "sndPlaySound // can't open WaveOut device !\n");
140 goto ErrSND;
142 USER_HEAP_FREE(hFormat);
143 hWaveHdr = USER_HEAP_ALLOC(sizeof(WAVEHDR));
144 lpWaveHdr = (LPWAVEHDR) USER_HEAP_LIN_ADDR(hWaveHdr);
145 lp16WaveHdr = (LPWAVEHDR) USER_HEAP_SEG_ADDR(hWaveHdr);
146 bufsize = 64000;
147 hData = GlobalAlloc(GMEM_MOVEABLE, bufsize);
148 lpWaveHdr->lpData = (LPSTR) WIN16_GlobalLock(hData);
149 lpWaveHdr->dwBufferLength = bufsize;
150 lpWaveHdr->dwUser = 0L;
151 lpWaveHdr->dwFlags = 0L;
152 lpWaveHdr->dwLoops = 0L;
153 dwRet = wodMessage(0, WODM_PREPARE, 0, (DWORD)lp16WaveHdr, sizeof(WAVEHDR));
154 if (dwRet != MMSYSERR_NOERROR) {
155 dprintf_mmsys(stddeb, "sndPlaySound // can't prepare WaveOut device !\n");
156 GlobalUnlock(hData);
157 GlobalFree(hData);
158 USER_HEAP_FREE(hDesc);
159 USER_HEAP_FREE(hWaveHdr);
160 goto ErrSND;
162 while(TRUE) {
163 count = mmioRead(hmmio, PTR_SEG_TO_LIN(lpWaveHdr->lpData), bufsize);
164 if (count < 1) break;
165 lpWaveHdr->dwBufferLength = count;
166 /* lpWaveHdr->dwBytesRecorded = count; */
167 wodMessage(0, WODM_WRITE, 0, (DWORD)lp16WaveHdr, sizeof(WAVEHDR));
169 wodMessage(0, WODM_UNPREPARE, 0, (DWORD)lp16WaveHdr, sizeof(WAVEHDR));
170 wodMessage(0, WODM_CLOSE, 0, 0L, 0L);
171 GlobalUnlock(hData);
172 GlobalFree(hData);
173 USER_HEAP_FREE(hDesc);
174 USER_HEAP_FREE(hWaveHdr);
175 if (hmmio != 0) mmioClose(hmmio, 0);
176 return TRUE;
179 /**************************************************************************
180 * mmsystemGetVersion [MMSYSTEM.5]
182 WORD mmsystemGetVersion()
184 dprintf_mmsys(stddeb, "mmsystemGetVersion // 0.4.0 ...?... :-) !\n");
185 return 0x0040;
188 /**************************************************************************
189 * DriverProc [MMSYSTEM.6]
191 LRESULT DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
192 DWORD dwParam1, DWORD dwParam2)
194 return DrvDefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
197 /**************************************************************************
198 * OutputDebugStr [MMSYSTEM.30]
200 void OutputDebugStr(LPCSTR str)
202 fprintf(stdnimp, "EMPTY STUB !!! OutputDebugStr('%s');\n", str);
205 /**************************************************************************
206 * DriverCallback [MMSYSTEM.31]
208 BOOL DriverCallback(DWORD dwCallBack, UINT uFlags, HANDLE hDev,
209 WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
211 dprintf_mmsys(stddeb, "DriverCallback(%08lX, %04X, %04X, %04X, %08lX, %08lX, %08lX); !\n",
212 dwCallBack, uFlags, hDev, wMsg, dwUser, dwParam1, dwParam2);
213 switch(uFlags & DCB_TYPEMASK) {
214 case DCB_NULL:
215 dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_NULL !\n");
216 break;
217 case DCB_WINDOW:
218 dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_WINDOW !\n");
219 break;
220 case DCB_TASK:
221 dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_TASK !\n");
222 break;
223 case DCB_FUNCTION:
224 dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_FUNCTION !\n");
225 break;
227 return TRUE;
230 /**************************************************************************
231 * auxGetNumDevs [MMSYSTEM.350]
233 UINT auxGetNumDevs()
235 UINT count = 0;
236 dprintf_mmsys(stddeb, "auxGetNumDevs !\n");
237 count += auxMessage(0, AUXDM_GETNUMDEVS, 0L, 0L, 0L);
238 dprintf_mmsys(stddeb, "auxGetNumDevs return %u \n", count);
239 return count;
242 /**************************************************************************
243 * auxGetDevCaps [MMSYSTEM.351]
245 UINT auxGetDevCaps(UINT uDeviceID, AUXCAPS FAR* lpCaps, UINT uSize)
247 dprintf_mmsys(stddeb, "auxGetDevCaps(%04X, %p, %d) !\n",
248 uDeviceID, lpCaps, uSize);
249 return auxMessage(uDeviceID, AUXDM_GETDEVCAPS,
250 0L, (DWORD)lpCaps, (DWORD)uSize);
253 /**************************************************************************
254 * auxGetVolume [MMSYSTEM.352]
256 UINT auxGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume)
258 dprintf_mmsys(stddeb, "auxGetVolume(%04X, %p) !\n", uDeviceID, lpdwVolume);
259 return auxMessage(uDeviceID, AUXDM_GETVOLUME, 0L, (DWORD)lpdwVolume, 0L);
262 /**************************************************************************
263 * auxSetVolume [MMSYSTEM.353]
265 UINT auxSetVolume(UINT uDeviceID, DWORD dwVolume)
267 dprintf_mmsys(stddeb, "auxSetVolume(%04X, %08lX) !\n", uDeviceID, dwVolume);
268 return auxMessage(uDeviceID, AUXDM_SETVOLUME, 0L, dwVolume, 0L);
271 /**************************************************************************
272 * auxOutMessage [MMSYSTEM.354]
274 DWORD auxOutMessage(UINT uDeviceID, UINT uMessage, DWORD dw1, DWORD dw2)
276 dprintf_mmsys(stddeb, "auxOutMessage(%04X, %04X, %08lX, %08lX)\n",
277 uDeviceID, uMessage, dw1, dw2);
278 return auxMessage(uDeviceID, uMessage, 0L, dw1, dw2);
281 /**************************************************************************
282 * mciGetErrorString [MMSYSTEM.706]
284 BOOL mciGetErrorString (DWORD wError, LPSTR lpstrBuffer, UINT uLength)
286 LPSTR msgptr;
287 dprintf_mmsys(stddeb, "mciGetErrorString(%08lX, %p, %d);\n", wError, lpstrBuffer, uLength);
288 if ((lpstrBuffer == NULL) || (uLength < 1)) return(FALSE);
289 lpstrBuffer[0] = '\0';
290 switch(wError) {
291 case MCIERR_INVALID_DEVICE_ID:
292 msgptr = "Invalid MCI device ID. Use the ID returned when opening the MCI device.";
293 break;
294 case MCIERR_UNRECOGNIZED_KEYWORD:
295 msgptr = "The driver cannot recognize the specified command parameter.";
296 break;
297 case MCIERR_UNRECOGNIZED_COMMAND:
298 msgptr = "The driver cannot recognize the specified command.";
299 break;
300 case MCIERR_HARDWARE:
301 msgptr = "There is a problem with your media device. Make sure it is working correctly or contact the device manufacturer.";
302 break;
303 case MCIERR_INVALID_DEVICE_NAME:
304 msgptr = "The specified device is not open or is not recognized by MCI.";
305 break;
306 case MCIERR_OUT_OF_MEMORY:
307 msgptr = "Not enough memory available for this task. \nQuit one or more applications to increase available memory, and then try again.";
308 break;
309 case MCIERR_DEVICE_OPEN:
310 msgptr = "The device name is already being used as an alias by this application. Use a unique alias.";
311 break;
312 case MCIERR_CANNOT_LOAD_DRIVER:
313 msgptr = "There is an undetectable problem in loading the specified device driver.";
314 break;
315 case MCIERR_MISSING_COMMAND_STRING:
316 msgptr = "No command was specified.";
317 break;
318 case MCIERR_PARAM_OVERFLOW:
319 msgptr = "The output string was to large to fit in the return buffer. Increase the size of the buffer.";
320 break;
321 case MCIERR_MISSING_STRING_ARGUMENT:
322 msgptr = "The specified command requires a character-string parameter. Please provide one.";
323 break;
324 case MCIERR_BAD_INTEGER:
325 msgptr = "The specified integer is invalid for this command.";
326 break;
327 case MCIERR_PARSER_INTERNAL:
328 msgptr = "The device driver returned an invalid return type. Check with the device manufacturer about obtaining a new driver.";
329 break;
330 case MCIERR_DRIVER_INTERNAL:
331 msgptr = "There is a problem with the device driver. Check with the device manufacturer about obtaining a new driver.";
332 break;
333 case MCIERR_MISSING_PARAMETER:
334 msgptr = "The specified command requires a parameter. Please supply one.";
335 break;
336 case MCIERR_UNSUPPORTED_FUNCTION:
337 msgptr = "The MCI device you are using does not support the specified command.";
338 break;
339 case MCIERR_FILE_NOT_FOUND:
340 msgptr = "Cannot find the specified file. Make sure the path and filename are correct.";
341 break;
342 case MCIERR_DEVICE_NOT_READY:
343 msgptr = "The device driver is not ready.";
344 break;
345 case MCIERR_INTERNAL:
346 msgptr = "A problem occurred in initializing MCI. Try restarting Windows.";
347 break;
348 case MCIERR_DRIVER:
349 msgptr = "There is a problem with the device driver. The driver has closed. Cannot access error.";
350 break;
351 case MCIERR_CANNOT_USE_ALL:
352 msgptr = "Cannot use 'all' as the device name with the specified command.";
353 break;
354 case MCIERR_MULTIPLE:
355 msgptr = "Errors occurred in more than one device. Specify each command and device separately to determine which devices caused the error";
356 break;
357 case MCIERR_EXTENSION_NOT_FOUND:
358 msgptr = "Cannot determine the device type from the given filename extension.";
359 break;
360 case MCIERR_OUTOFRANGE:
361 msgptr = "The specified parameter is out of range for the specified command.";
362 break;
363 case MCIERR_FLAGS_NOT_COMPATIBLE:
364 msgptr = "The specified parameters cannot be used together.";
365 break;
366 case MCIERR_FILE_NOT_SAVED:
367 msgptr = "Cannot save the specified file. Make sure you have enough disk space or are still connected to the network.";
368 break;
369 case MCIERR_DEVICE_TYPE_REQUIRED:
370 msgptr = "Cannot find the specified device. Make sure it is installed or that the device name is spelled correctly.";
371 break;
372 case MCIERR_DEVICE_LOCKED:
373 msgptr = "The specified device is now being closed. Wait a few seconds, and then try again.";
374 break;
375 case MCIERR_DUPLICATE_ALIAS:
376 msgptr = "The specified alias is already being used in this application. Use a unique alias.";
377 break;
378 case MCIERR_BAD_CONSTANT:
379 msgptr = "The specified parameter is invalid for this command.";
380 break;
381 case MCIERR_MUST_USE_SHAREABLE:
382 msgptr = "The device driver is already in use. To share it, use the 'shareable' parameter with each 'open' command.";
383 break;
384 case MCIERR_MISSING_DEVICE_NAME:
385 msgptr = "The specified command requires an alias, file, driver, or device name. Please supply one.";
386 break;
387 case MCIERR_BAD_TIME_FORMAT:
388 msgptr = "The specified value for the time format is invalid. Refer to the MCI documentation for valid formats.";
389 break;
390 case MCIERR_NO_CLOSING_QUOTE:
391 msgptr = "A closing double-quotation mark is missing from the parameter value. Please supply one.";
392 break;
393 case MCIERR_DUPLICATE_FLAGS:
394 msgptr = "A parameter or value was specified twice. Only specify it once.";
395 break;
396 case MCIERR_INVALID_FILE:
397 msgptr = "The specified file cannot be played on the specified MCI device. The file may be corrupt, or not in the correct format.";
398 break;
399 case MCIERR_NULL_PARAMETER_BLOCK:
400 msgptr = "A null parameter block was passed to MCI.";
401 break;
402 case MCIERR_UNNAMED_RESOURCE:
403 msgptr = "Cannot save an unnamed file. Supply a filename.";
404 break;
405 case MCIERR_NEW_REQUIRES_ALIAS:
406 msgptr = "You must specify an alias when using the 'new' parameter.";
407 break;
408 case MCIERR_NOTIFY_ON_AUTO_OPEN:
409 msgptr = "Cannot use the 'notify' flag with auto-opened devices.";
410 break;
411 case MCIERR_NO_ELEMENT_ALLOWED:
412 msgptr = "Cannot use a filename with the specified device.";
413 break;
414 case MCIERR_NONAPPLICABLE_FUNCTION:
415 msgptr = "Cannot carry out the commands in the order specified. Correct the command sequence, and then try again.";
416 break;
417 case MCIERR_ILLEGAL_FOR_AUTO_OPEN:
418 msgptr = "Cannot carry out the specified command on an auto-opened device. Wait until the device is closed, and then try again.";
419 break;
420 case MCIERR_FILENAME_REQUIRED:
421 msgptr = "The filename is invalid. Make sure the filename is not longer than 8 characters, followed by a period and an extension.";
422 break;
423 case MCIERR_EXTRA_CHARACTERS:
424 msgptr = "Cannot specify extra characters after a string enclosed in quotation marks.";
425 break;
426 case MCIERR_DEVICE_NOT_INSTALLED:
427 msgptr = "The specified device is not installed on the system. Use the Drivers option in Control Panel to install the device.";
428 break;
429 case MCIERR_GET_CD:
430 msgptr = "Cannot access the specified file or MCI device. Try changing directories or restarting your computer.";
431 break;
432 case MCIERR_SET_CD:
433 msgptr = "Cannot access the specified file or MCI device because the application cannot change directories.";
434 break;
435 case MCIERR_SET_DRIVE:
436 msgptr = "Cannot access specified file or MCI device because the application cannot change drives.";
437 break;
438 case MCIERR_DEVICE_LENGTH:
439 msgptr = "Specify a device or driver name that is less than 79 characters.";
440 break;
441 case MCIERR_DEVICE_ORD_LENGTH:
442 msgptr = "Specify a device or driver name that is less than 69 characters.";
443 break;
444 case MCIERR_NO_INTEGER:
445 msgptr = "The specified command requires an integer parameter. Please provide one.";
446 break;
447 case MCIERR_WAVE_OUTPUTSINUSE:
448 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.";
449 break;
450 case MCIERR_WAVE_SETOUTPUTINUSE:
451 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.";
452 break;
453 case MCIERR_WAVE_INPUTSINUSE:
454 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.";
455 break;
456 case MCIERR_WAVE_SETINPUTINUSE:
457 msgptr = "Cannot set the current wave device for recording because it is in use. Wait until the device is free, and then try again.";
458 break;
459 case MCIERR_WAVE_OUTPUTUNSPECIFIED:
460 msgptr = "Any compatible waveform playback device may be used.";
461 break;
462 case MCIERR_WAVE_INPUTUNSPECIFIED:
463 msgptr = "Any compatible waveform recording device may be used.";
464 break;
465 case MCIERR_WAVE_OUTPUTSUNSUITABLE:
466 msgptr = "No wave device that can play files in the current format is installed. Use the Drivers option to install the wave device.";
467 break;
468 case MCIERR_WAVE_SETOUTPUTUNSUITABLE:
469 msgptr = "The device you are trying to play to cannot recognize the current file format.";
470 break;
471 case MCIERR_WAVE_INPUTSUNSUITABLE:
472 msgptr = "No wave device that can record files in the current format is installed. Use the Drivers option to install the wave device.";
473 break;
474 case MCIERR_WAVE_SETINPUTUNSUITABLE:
475 msgptr = "The device you are trying to record from cannot recognize the current file format.";
476 break;
477 case MCIERR_NO_WINDOW:
478 msgptr = "There is no display window.";
479 break;
480 case MCIERR_CREATEWINDOW:
481 msgptr = "Could not create or use window.";
482 break;
483 case MCIERR_FILE_READ:
484 msgptr = "Cannot read the specified file. Make sure the file is still present, or check your disk or network connection.";
485 break;
486 case MCIERR_FILE_WRITE:
487 msgptr = "Cannot write to the specified file. Make sure you have enough disk space or are still connected to the network.";
488 break;
491 #define MCIERR_SEQ_DIV_INCOMPATIBLE (MCIERR_BASE + 80)
492 #define MCIERR_SEQ_PORT_INUSE (MCIERR_BASE + 81)
493 #define MCIERR_SEQ_PORT_NONEXISTENT (MCIERR_BASE + 82)
494 #define MCIERR_SEQ_PORT_MAPNODEVICE (MCIERR_BASE + 83)
495 #define MCIERR_SEQ_PORT_MISCERROR (MCIERR_BASE + 84)
496 #define MCIERR_SEQ_TIMER (MCIERR_BASE + 85)
497 #define MCIERR_SEQ_PORTUNSPECIFIED (MCIERR_BASE + 86)
498 #define MCIERR_SEQ_NOMIDIPRESENT (MCIERR_BASE + 87)
500 msg# 513 : vcr
501 msg# 514 : videodisc
502 msg# 515 : overlay
503 msg# 516 : cdaudio
504 msg# 517 : dat
505 msg# 518 : scanner
506 msg# 519 : animation
507 msg# 520 : digitalvideo
508 msg# 521 : other
509 msg# 522 : waveaudio
510 msg# 523 : sequencer
511 msg# 524 : not ready
512 msg# 525 : stopped
513 msg# 526 : playing
514 msg# 527 : recording
515 msg# 528 : seeking
516 msg# 529 : paused
517 msg# 530 : open
518 msg# 531 : false
519 msg# 532 : true
520 msg# 533 : milliseconds
521 msg# 534 : hms
522 msg# 535 : msf
523 msg# 536 : frames
524 msg# 537 : smpte 24
525 msg# 538 : smpte 25
526 msg# 539 : smpte 30
527 msg# 540 : smpte 30 drop
528 msg# 541 : bytes
529 msg# 542 : samples
530 msg# 543 : tmsf
532 default:
533 msgptr = "Unknown MCI Error !\n";
534 break;
536 lstrcpyn(lpstrBuffer, msgptr, uLength);
537 return TRUE;
541 /**************************************************************************
542 * mciDriverNotify [MMSYSTEM.711]
544 BOOL mciDriverNotify(HWND hWndCallBack, UINT wDevID, UINT wStatus)
546 dprintf_mmsys(stddeb, "mciDriverNotify(%04X, %u, %04X)\n", hWndCallBack, wDevID, wStatus);
547 if (!IsWindow(hWndCallBack)) return FALSE;
548 dprintf_mmsys(stddeb, "mciDriverNotify // before PostMessage\n");
549 PostMessage(hWndCallBack, MM_MCINOTIFY, wStatus,
550 MAKELONG(mciDrv[wDevID].wDeviceID, 0));
551 return TRUE;
554 /**************************************************************************
555 * mciOpen [internal]
557 DWORD mciOpen(DWORD dwParam, LPMCI_OPEN_PARMS lp16Parms)
559 char str[128];
560 LPMCI_OPEN_PARMS lpParms;
561 UINT uDevTyp = 0;
562 UINT wDevID = 0;
563 lpParms = PTR_SEG_TO_LIN(lp16Parms);
564 dprintf_mmsys(stddeb, "mciOpen(%08lX, %p (%p))\n", dwParam, lp16Parms, lpParms);
565 if (lp16Parms == NULL) return MCIERR_INTERNAL;
566 while(mciDrv[wDevID].wType != 0) {
567 if (++wDevID >= MAXMCIDRIVERS) {
568 dprintf_mmsys(stddeb, "MCI_OPEN // MAXMCIDRIVERS reached !\n");
569 return MCIERR_INTERNAL;
572 dprintf_mmsys(stddeb, "mciOpen // wDevID=%d \n", wDevID);
573 if (dwParam & MCI_OPEN_ALIAS) {
574 dprintf_mmsys(stddeb, "MCI_OPEN // Alias='%s' !\n",
575 (char*)PTR_SEG_TO_LIN(lpParms->lpstrAlias));
576 uDevTyp = MCI_DEVTYPE_WAVEFORM_AUDIO;
578 if (dwParam & MCI_OPEN_TYPE) {
579 if (dwParam & MCI_OPEN_TYPE_ID) {
580 dprintf_mmsys(stddeb, "MCI_OPEN // Dev=%p !\n", lpParms->lpstrDeviceType);
581 uDevTyp = LOWORD((DWORD)lpParms->lpstrDeviceType);
583 else {
584 if (lpParms->lpstrDeviceType == NULL) return MCIERR_INTERNAL;
585 dprintf_mmsys(stddeb, "MCI_OPEN // Dev='%s' !\n",
586 (char*)PTR_SEG_TO_LIN(lpParms->lpstrDeviceType));
587 strcpy(str, PTR_SEG_TO_LIN(lpParms->lpstrDeviceType));
588 AnsiUpper(str);
589 if (strcmp(str, "CDAUDIO") == 0) {
590 uDevTyp = MCI_DEVTYPE_CD_AUDIO;
592 else
593 if (strcmp(str, "WAVEAUDIO") == 0) {
594 uDevTyp = MCI_DEVTYPE_WAVEFORM_AUDIO;
596 else
597 if (strcmp(str, "SEQUENCER") == 0) {
598 uDevTyp = MCI_DEVTYPE_SEQUENCER;
600 else
601 if (strcmp(str, "ANIMATION1") == 0) {
602 uDevTyp = MCI_DEVTYPE_ANIMATION;
604 else
605 if (strcmp(str, "AVIVIDEO") == 0) {
606 uDevTyp = MCI_DEVTYPE_DIGITAL_VIDEO;
610 mciDrv[wDevID].wType = uDevTyp;
611 mciDrv[wDevID].wDeviceID = wDevID;
612 lpParms->wDeviceID = wDevID;
613 dprintf_mmsys(stddeb, "MCI_OPEN // mcidev=%d, uDevTyp=%04X wDeviceID=%04X !\n",
614 wDevID, uDevTyp, lpParms->wDeviceID);
615 switch(uDevTyp) {
616 case MCI_DEVTYPE_CD_AUDIO:
617 #ifdef WINELIB
618 WINELIB_UNIMP ("CDAUDIO_DriverProc");
619 #else
620 return CDAUDIO_DriverProc(0, 0, MCI_OPEN_DRIVER,
621 dwParam, (DWORD)lp16Parms);
622 #endif
623 case MCI_DEVTYPE_WAVEFORM_AUDIO:
624 return WAVE_DriverProc(0, 0, MCI_OPEN_DRIVER,
625 dwParam, (DWORD)lp16Parms);
626 case MCI_DEVTYPE_SEQUENCER:
627 return MIDI_DriverProc(0, 0, MCI_OPEN_DRIVER,
628 dwParam, (DWORD)lp16Parms);
629 case MCI_DEVTYPE_ANIMATION:
630 return ANIM_DriverProc(0, 0, MCI_OPEN_DRIVER,
631 dwParam, (DWORD)lp16Parms);
632 case MCI_DEVTYPE_DIGITAL_VIDEO:
633 dprintf_mmsys(stddeb, "MCI_OPEN // No DIGITAL_VIDEO yet !\n");
634 return MCIERR_DEVICE_NOT_INSTALLED;
635 default:
636 dprintf_mmsys(stddeb, "MCI_OPEN // Invalid Device Name '%p' !\n", lpParms->lpstrDeviceType);
637 return MCIERR_INVALID_DEVICE_NAME;
639 return MCIERR_INTERNAL;
643 /**************************************************************************
644 * mciClose [internal]
646 DWORD mciClose(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
648 DWORD dwRet = MCIERR_INTERNAL;
649 dprintf_mmsys(stddeb, "mciClose(%u, %08lX, %p)\n", wDevID, dwParam, lpParms);
650 switch(mciDrv[wDevID].wType) {
651 case MCI_DEVTYPE_CD_AUDIO:
652 #ifndef WINELIB
653 dwRet = CDAUDIO_DriverProc(mciDrv[wDevID].wDeviceID, 0,
654 MCI_CLOSE, dwParam, (DWORD)lpParms);
655 #endif
656 break;
657 case MCI_DEVTYPE_WAVEFORM_AUDIO:
658 dwRet = WAVE_DriverProc(mciDrv[wDevID].wDeviceID, 0,
659 MCI_CLOSE, dwParam, (DWORD)lpParms);
660 break;
661 case MCI_DEVTYPE_SEQUENCER:
662 dwRet = MIDI_DriverProc(mciDrv[wDevID].wDeviceID, 0,
663 MCI_CLOSE, dwParam, (DWORD)lpParms);
664 break;
665 case MCI_DEVTYPE_ANIMATION:
666 dwRet = ANIM_DriverProc(mciDrv[wDevID].wDeviceID, 0,
667 MCI_CLOSE, dwParam, (DWORD)lpParms);
668 break;
669 default:
670 dprintf_mmsys(stddeb, "mciClose() // unknown device type=%04X !\n", mciDrv[wDevID].wType);
672 mciDrv[wDevID].wType = 0;
673 return dwRet;
677 /**************************************************************************
678 * mciSound [internal]
680 DWORD mciSysInfo(DWORD dwFlags, LPMCI_SYSINFO_PARMS lpParms)
682 int len;
683 LPSTR ptr;
684 LPSTR lpstrReturn;
685 DWORD *lpdwRet;
686 LPSTR SysFile = "SYSTEM.INI";
687 dprintf_mci(stddeb, "mciSysInfo(%08lX, %08lX)\n", dwFlags, (DWORD)lpParms);
688 lpstrReturn = PTR_SEG_TO_LIN(lpParms->lpstrReturn);
689 switch(dwFlags) {
690 case MCI_SYSINFO_QUANTITY:
691 dprintf_mci(stddeb, "mciSysInfo // MCI_SYSINFO_QUANTITY \n");
692 lpdwRet = (DWORD *)lpstrReturn;
693 *(lpdwRet) = InstalledCount;
694 return 0;
695 case MCI_SYSINFO_INSTALLNAME:
696 dprintf_mci(stddeb, "mciSysInfo // MCI_SYSINFO_INSTALLNAME \n");
697 if (lpInstallNames == NULL) {
698 InstalledCount = 0;
699 InstalledListLen = 0;
700 ptr = lpInstallNames = xmalloc(2048);
701 GetPrivateProfileString("mci", NULL, "", lpInstallNames, 2000, SysFile);
702 while(strlen(ptr) > 0) {
703 dprintf_mci(stddeb, "---> '%s' \n", ptr);
704 len = strlen(ptr) + 1;
705 ptr += len;
706 InstalledListLen += len;
707 InstalledCount++;
710 if (lpParms->dwRetSize < InstalledListLen)
711 lstrcpyn(lpstrReturn, lpInstallNames, lpParms->dwRetSize - 1);
712 else
713 strcpy(lpstrReturn, lpInstallNames);
714 return 0;
715 case MCI_SYSINFO_NAME:
716 dprintf_mci(stddeb, "mciSysInfo // MCI_SYSINFO_NAME \n");
717 return 0;
718 case MCI_SYSINFO_OPEN:
719 dprintf_mci(stddeb, "mciSysInfo // MCI_SYSINFO_OPEN \n");
720 return 0;
722 return MMSYSERR_INVALPARAM;
725 /**************************************************************************
726 * mciSound [internal]
728 DWORD mciSound(UINT wDevID, DWORD dwParam, LPMCI_SOUND_PARMS lpParms)
730 if (lpParms == NULL) return MCIERR_INTERNAL;
731 if (dwParam & MCI_SOUND_NAME)
732 dprintf_mci(stddeb, "MCI_SOUND // file='%s' !\n", lpParms->lpstrSoundName);
733 return MCIERR_INVALID_DEVICE_ID;
738 /**************************************************************************
739 * mciSendCommand [MMSYSTEM.701]
741 DWORD mciSendCommand(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2)
743 HDRVR hDrv = 0;
744 dprintf_mci(stddeb, "mciSendCommand(%04X, %04X, %08lX, %08lX)\n",
745 wDevID, wMsg, dwParam1, dwParam2);
746 switch(wMsg) {
747 case MCI_OPEN:
748 return mciOpen(dwParam1, (LPMCI_OPEN_PARMS)dwParam2);
749 case MCI_CLOSE:
750 return mciClose(wDevID, dwParam1, (LPMCI_GENERIC_PARMS)PTR_SEG_TO_LIN(dwParam2));
751 case MCI_SYSINFO:
752 return mciSysInfo(dwParam1, (LPMCI_SYSINFO_PARMS)PTR_SEG_TO_LIN(dwParam2));
753 default:
754 switch(mciDrv[wDevID].wType) {
755 case MCI_DEVTYPE_CD_AUDIO:
756 #ifndef WINELIB
757 return CDAUDIO_DriverProc(mciDrv[wDevID].wDeviceID, hDrv,
758 wMsg, dwParam1, dwParam2);
759 #endif
761 case MCI_DEVTYPE_WAVEFORM_AUDIO:
762 return WAVE_DriverProc(mciDrv[wDevID].wDeviceID, hDrv,
763 wMsg, dwParam1, dwParam2);
764 case MCI_DEVTYPE_SEQUENCER:
765 return MIDI_DriverProc(mciDrv[wDevID].wDeviceID, hDrv,
766 wMsg, dwParam1, dwParam2);
767 case MCI_DEVTYPE_ANIMATION:
768 return ANIM_DriverProc(mciDrv[wDevID].wDeviceID, hDrv,
769 wMsg, dwParam1, dwParam2);
770 default:
771 dprintf_mci(stddeb, "mciSendCommand() // unknown device type=%04X !\n",
772 mciDrv[wDevID].wType);
775 return MMSYSERR_INVALPARAM;
778 /**************************************************************************
779 * mciGetDeviceID [MMSYSTEM.703]
781 UINT mciGetDeviceID (LPCSTR lpstrName)
783 char str[128];
784 dprintf_mci(stddeb, "mciGetDeviceID(%s)\n", lpstrName);
785 if (lpstrName != NULL) {
786 strcpy(str, lpstrName);
787 AnsiUpper(str);
788 if (strcmp(str, "ALL") == 0) return MCI_ALL_DEVICE_ID;
790 return 0;
793 /**************************************************************************
794 * mciSetYieldProc [MMSYSTEM.714]
796 BOOL mciSetYieldProc (UINT uDeviceID,
797 YIELDPROC fpYieldProc, DWORD dwYieldData)
799 return FALSE;
802 /**************************************************************************
803 * mciGetDeviceIDFromElementID [MMSYSTEM.715]
805 UINT mciGetDeviceIDFromElementID(DWORD dwElementID, LPCSTR lpstrType)
807 return 0;
810 /**************************************************************************
811 * mciGetYieldProc [MMSYSTEM.716]
813 YIELDPROC mciGetYieldProc(UINT uDeviceID, DWORD FAR* lpdwYieldData)
815 return NULL;
818 /**************************************************************************
819 * mciGetCreatorTask [MMSYSTEM.717]
821 HTASK mciGetCreatorTask(UINT uDeviceID)
823 return 0;
826 /**************************************************************************
827 * midiOutGetNumDevs [MMSYSTEM.201]
829 UINT midiOutGetNumDevs(void)
831 UINT count = 0;
832 dprintf_mmsys(stddeb, "midiOutGetNumDevs\n");
833 count += modMessage(0, MODM_GETNUMDEVS, 0L, 0L, 0L);
834 dprintf_mmsys(stddeb, "midiOutGetNumDevs return %u \n", count);
835 return count;
838 /**************************************************************************
839 * midiOutGetDevCaps [MMSYSTEM.202]
841 UINT midiOutGetDevCaps(UINT uDeviceID, MIDIOUTCAPS FAR* lpCaps, UINT uSize)
843 dprintf_mmsys(stddeb, "midiOutGetDevCaps\n");
844 return 0;
847 /**************************************************************************
848 * midiOutGetErrorText [MMSYSTEM.203]
850 UINT midiOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
852 dprintf_mmsys(stddeb, "midiOutGetErrorText\n");
853 return midiGetErrorText(uError, lpText, uSize);
857 /**************************************************************************
858 * midiGetErrorText [internal]
860 UINT midiGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
862 LPSTR msgptr;
863 if ((lpText == NULL) || (uSize < 1)) return(FALSE);
864 lpText[0] = '\0';
865 switch(uError) {
866 case MIDIERR_UNPREPARED:
867 msgptr = "The MIDI header was not prepared. Use the Prepare function to prepare the header, and then try again.";
868 break;
869 case MIDIERR_STILLPLAYING:
870 msgptr = "Cannot perform this operation while media data is still playing. Reset the device, or wait until the data is finished playing.";
871 break;
872 case MIDIERR_NOMAP:
873 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.";
874 break;
875 case MIDIERR_NOTREADY:
876 msgptr = "The port is transmitting data to the device. Wait until the data has been transmitted, and then try again.";
877 break;
878 case MIDIERR_NODEVICE:
879 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.";
880 break;
881 case MIDIERR_INVALIDSETUP:
882 msgptr = "The current MIDI setup is damaged. Copy the original MIDIMAP.CFG file to the Windows SYSTEM directory, and then try again.";
883 break;
885 msg# 336 : Cannot use the song-pointer time format and the SMPTE time-format together.
886 msg# 337 : The specified MIDI device is already in use. Wait until it is free, and then try again.
887 msg# 338 : The specified MIDI device is not installed on the system. Use the Drivers option in Control Panel to install the driver.
888 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.
889 msg# 340 : An error occurred using the specified port.
890 msg# 341 : All multimedia timers are being used by other applications. Quit one of these applications, and then try again.
891 msg# 342 : There is no current MIDI port.
892 msg# 343 : There are no MIDI devices installed on the system. Use the Drivers option in Control Panel to install the driver.
894 default:
895 msgptr = "Unknown MIDI Error !\n";
896 break;
898 lstrcpyn(lpText, msgptr, uSize);
899 return TRUE;
902 /**************************************************************************
903 * midiOutOpen [MMSYSTEM.204]
905 UINT midiOutOpen(HMIDIOUT FAR* lphMidiOut, UINT uDeviceID,
906 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
908 HMIDI hMidiOut;
909 LPMIDIOPENDESC lpDesc;
910 LPMIDIOPENDESC lp16Desc;
911 DWORD dwRet = 0;
912 BOOL bMapperFlg = FALSE;
913 if (lphMidiOut != NULL) *lphMidiOut = 0;
914 dprintf_mmsys(stddeb, "midiOutOpen(%p, %d, %08lX, %08lX, %08lX);\n",
915 lphMidiOut, uDeviceID, dwCallback, dwInstance, dwFlags);
916 if (uDeviceID == (UINT)MIDI_MAPPER) {
917 dprintf_mmsys(stddeb, "midiOutOpen // MIDI_MAPPER mode requested !\n");
918 bMapperFlg = TRUE;
919 uDeviceID = 0;
921 hMidiOut = USER_HEAP_ALLOC(sizeof(MIDIOPENDESC));
922 if (lphMidiOut != NULL) *lphMidiOut = hMidiOut;
923 lp16Desc = (LPMIDIOPENDESC) USER_HEAP_SEG_ADDR(hMidiOut);
924 lpDesc = (LPMIDIOPENDESC) PTR_SEG_TO_LIN(lp16Desc);
925 if (lpDesc == NULL) return MMSYSERR_NOMEM;
926 lpDesc->hMidi = hMidiOut;
927 lpDesc->dwCallback = dwCallback;
928 lpDesc->dwInstance = dwInstance;
929 while(uDeviceID < MAXMIDIDRIVERS) {
930 dwRet = modMessage(uDeviceID, MODM_OPEN,
931 lpDesc->dwInstance, (DWORD)lp16Desc, 0L);
932 if (dwRet == MMSYSERR_NOERROR) break;
933 if (!bMapperFlg) break;
934 uDeviceID++;
935 dprintf_mmsys(stddeb, "midiOutOpen // MIDI_MAPPER mode ! try next driver...\n");
937 return dwRet;
940 /**************************************************************************
941 * midiOutClose [MMSYSTEM.205]
943 UINT midiOutClose(HMIDIOUT hMidiOut)
945 LPMIDIOPENDESC lpDesc;
946 dprintf_mmsys(stddeb, "midiOutClose(%04X)\n", hMidiOut);
947 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
948 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
949 return modMessage(0, MODM_CLOSE, lpDesc->dwInstance, 0L, 0L);
952 /**************************************************************************
953 * midiOutPrepareHeader [MMSYSTEM.206]
955 UINT midiOutPrepareHeader(HMIDIOUT hMidiOut,
956 MIDIHDR FAR* lpMidiOutHdr, UINT uSize)
958 LPMIDIOPENDESC lpDesc;
959 dprintf_mmsys(stddeb, "midiOutPrepareHeader(%04X, %p, %d)\n",
960 hMidiOut, lpMidiOutHdr, uSize);
961 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
962 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
963 return modMessage(0, MODM_PREPARE, lpDesc->dwInstance,
964 (DWORD)lpMidiOutHdr, (DWORD)uSize);
967 /**************************************************************************
968 * midiOutUnprepareHeader [MMSYSTEM.207]
970 UINT midiOutUnprepareHeader(HMIDIOUT hMidiOut,
971 MIDIHDR FAR* lpMidiOutHdr, UINT uSize)
973 LPMIDIOPENDESC lpDesc;
974 dprintf_mmsys(stddeb, "midiOutUnprepareHeader(%04X, %p, %d)\n",
975 hMidiOut, lpMidiOutHdr, uSize);
976 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
977 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
978 return modMessage(0, MODM_UNPREPARE, lpDesc->dwInstance,
979 (DWORD)lpMidiOutHdr, (DWORD)uSize);
982 /**************************************************************************
983 * midiOutShortMsg [MMSYSTEM.208]
985 UINT midiOutShortMsg(HMIDIOUT hMidiOut, DWORD dwMsg)
987 LPMIDIOPENDESC lpDesc;
988 dprintf_mmsys(stddeb, "midiOutShortMsg(%04X, %08lX)\n", hMidiOut, dwMsg);
989 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
990 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
991 return modMessage(0, MODM_DATA, lpDesc->dwInstance, dwMsg, 0L);
994 /**************************************************************************
995 * midiOutLongMsg [MMSYSTEM.209]
997 UINT midiOutLongMsg(HMIDIOUT hMidiOut,
998 MIDIHDR FAR* lpMidiOutHdr, UINT uSize)
1000 LPMIDIOPENDESC lpDesc;
1001 dprintf_mmsys(stddeb, "midiOutLongMsg(%04X, %p, %d)\n",
1002 hMidiOut, lpMidiOutHdr, uSize);
1003 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1004 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1005 return modMessage(0, MODM_LONGDATA, lpDesc->dwInstance,
1006 (DWORD)lpMidiOutHdr, (DWORD)uSize);
1009 /**************************************************************************
1010 * midiOutReset [MMSYSTEM.210]
1012 UINT midiOutReset(HMIDIOUT hMidiOut)
1014 LPMIDIOPENDESC lpDesc;
1015 dprintf_mmsys(stddeb, "midiOutReset(%04X)\n", hMidiOut);
1016 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1017 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1018 return modMessage(0, MODM_RESET, lpDesc->dwInstance, 0L, 0L);
1021 /**************************************************************************
1022 * midiOutGetVolume [MMSYSTEM.211]
1024 UINT midiOutGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume)
1026 dprintf_mmsys(stddeb, "midiOutGetVolume(%04X, %p);\n", uDeviceID, lpdwVolume);
1027 return modMessage(uDeviceID, MODM_GETVOLUME, 0L, (DWORD)lpdwVolume, 0L);
1028 return 0;
1031 /**************************************************************************
1032 * midiOutSetVolume [MMSYSTEM.212]
1034 UINT midiOutSetVolume(UINT uDeviceID, DWORD dwVolume)
1036 dprintf_mmsys(stddeb, "midiOutSetVolume(%04X, %08lX);\n", uDeviceID, dwVolume);
1037 return modMessage(uDeviceID, MODM_SETVOLUME, 0L, dwVolume, 0L);
1038 return 0;
1041 /**************************************************************************
1042 * midiOutCachePatches [MMSYSTEM.213]
1044 UINT midiOutCachePatches(HMIDIOUT hMidiOut,
1045 UINT uBank, WORD FAR* lpwPatchArray, UINT uFlags)
1047 /* not really necessary to support this */
1048 fprintf(stdnimp, "midiOutCachePatches: not supported yet\n");
1049 return MMSYSERR_NOTSUPPORTED;
1052 /**************************************************************************
1053 * midiOutCacheDrumPatches [MMSYSTEM.214]
1055 UINT midiOutCacheDrumPatches(HMIDIOUT hMidiOut,
1056 UINT uPatch, WORD FAR* lpwKeyArray, UINT uFlags)
1058 fprintf(stdnimp, "midiOutCacheDrumPatchesi: not supported yet\n");
1059 return MMSYSERR_NOTSUPPORTED;
1062 /**************************************************************************
1063 * midiOutGetID [MMSYSTEM.215]
1065 UINT midiOutGetID(HMIDIOUT hMidiOut, UINT FAR* lpuDeviceID)
1067 dprintf_mmsys(stddeb, "midiOutGetID\n");
1068 return 0;
1071 /**************************************************************************
1072 * midiOutMessage [MMSYSTEM.216]
1074 DWORD midiOutMessage(HMIDIOUT hMidiOut, UINT uMessage,
1075 DWORD dwParam1, DWORD dwParam2)
1077 LPMIDIOPENDESC lpDesc;
1078 dprintf_mmsys(stddeb, "midiOutMessage(%04X, %04X, %08lX, %08lX)\n",
1079 hMidiOut, uMessage, dwParam1, dwParam2);
1080 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1081 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1082 return modMessage(0, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
1083 return 0;
1086 /**************************************************************************
1087 * midiInGetNumDevs [MMSYSTEM.301]
1089 UINT midiInGetNumDevs(void)
1091 UINT count = 0;
1092 dprintf_mmsys(stddeb, "midiInGetNumDevs\n");
1093 count += midMessage(0, MIDM_GETNUMDEVS, 0L, 0L, 0L);
1094 dprintf_mmsys(stddeb, "midiInGetNumDevs return %u \n", count);
1095 return count;
1098 /**************************************************************************
1099 * midiInGetDevCaps [MMSYSTEM.302]
1101 UINT midiInGetDevCaps(UINT uDeviceID,
1102 LPMIDIINCAPS lpCaps, UINT uSize)
1104 dprintf_mmsys(stddeb, "midiInGetDevCaps\n");
1105 return 0;
1108 /**************************************************************************
1109 * midiInGetErrorText [MMSYSTEM.303]
1111 UINT midiInGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
1113 dprintf_mmsys(stddeb, "midiInGetErrorText\n");
1114 return (midiGetErrorText(uError, lpText, uSize));
1117 /**************************************************************************
1118 * midiInOpen [MMSYSTEM.304]
1120 UINT midiInOpen(HMIDIIN FAR* lphMidiIn, UINT uDeviceID,
1121 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
1123 HMIDI hMidiIn;
1124 LPMIDIOPENDESC lpDesc;
1125 LPMIDIOPENDESC lp16Desc;
1126 DWORD dwRet = 0;
1127 BOOL bMapperFlg = FALSE;
1128 if (lphMidiIn != NULL) *lphMidiIn = 0;
1129 dprintf_mmsys(stddeb, "midiInOpen(%p, %d, %08lX, %08lX, %08lX);\n",
1130 lphMidiIn, uDeviceID, dwCallback, dwInstance, dwFlags);
1131 if (uDeviceID == (UINT)MIDI_MAPPER) {
1132 dprintf_mmsys(stddeb, "midiInOpen // MIDI_MAPPER mode requested !\n");
1133 bMapperFlg = TRUE;
1134 uDeviceID = 0;
1136 hMidiIn = USER_HEAP_ALLOC(sizeof(MIDIOPENDESC));
1137 if (lphMidiIn != NULL) *lphMidiIn = hMidiIn;
1138 lp16Desc = (LPMIDIOPENDESC) USER_HEAP_SEG_ADDR(hMidiIn);
1139 lpDesc = (LPMIDIOPENDESC) PTR_SEG_TO_LIN(lp16Desc);
1140 if (lpDesc == NULL) return MMSYSERR_NOMEM;
1141 lpDesc->hMidi = hMidiIn;
1142 lpDesc->dwCallback = dwCallback;
1143 lpDesc->dwInstance = dwInstance;
1144 while(uDeviceID < MAXMIDIDRIVERS) {
1145 dwRet = midMessage(uDeviceID, MIDM_OPEN,
1146 lpDesc->dwInstance, (DWORD)lpDesc, 0L);
1147 if (dwRet == MMSYSERR_NOERROR) break;
1148 if (!bMapperFlg) break;
1149 uDeviceID++;
1150 dprintf_mmsys(stddeb, "midiInOpen // MIDI_MAPPER mode ! try next driver...\n");
1152 return dwRet;
1155 /**************************************************************************
1156 * midiInClose [MMSYSTEM.305]
1158 UINT midiInClose(HMIDIIN hMidiIn)
1160 LPMIDIOPENDESC lpDesc;
1161 dprintf_mmsys(stddeb, "midiInClose(%04X)\n", hMidiIn);
1162 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
1163 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1164 return midMessage(0, MIDM_CLOSE, lpDesc->dwInstance, 0L, 0L);
1167 /**************************************************************************
1168 * midiInPrepareHeader [MMSYSTEM.306]
1170 UINT midiInPrepareHeader(HMIDIIN hMidiIn,
1171 MIDIHDR FAR* lpMidiInHdr, UINT uSize)
1173 LPMIDIOPENDESC lpDesc;
1174 dprintf_mmsys(stddeb, "midiInPrepareHeader(%04X, %p, %d)\n",
1175 hMidiIn, lpMidiInHdr, uSize);
1176 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
1177 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1178 return midMessage(0, MIDM_PREPARE, lpDesc->dwInstance,
1179 (DWORD)lpMidiInHdr, (DWORD)uSize);
1182 /**************************************************************************
1183 * midiInUnprepareHeader [MMSYSTEM.307]
1185 UINT midiInUnprepareHeader(HMIDIIN hMidiIn,
1186 MIDIHDR FAR* lpMidiInHdr, UINT uSize)
1188 LPMIDIOPENDESC lpDesc;
1189 dprintf_mmsys(stddeb, "midiInUnprepareHeader(%04X, %p, %d)\n",
1190 hMidiIn, lpMidiInHdr, uSize);
1191 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
1192 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1193 return midMessage(0, MIDM_UNPREPARE, lpDesc->dwInstance,
1194 (DWORD)lpMidiInHdr, (DWORD)uSize);
1197 /**************************************************************************
1198 * midiInAddBuffer [MMSYSTEM.308]
1200 UINT midiInAddBuffer(HMIDIIN hMidiIn,
1201 MIDIHDR FAR* lpMidiInHdr, UINT uSize)
1203 dprintf_mmsys(stddeb, "midiInAddBuffer\n");
1204 return 0;
1207 /**************************************************************************
1208 * midiInStart [MMSYSTEM.309]
1210 UINT midiInStart(HMIDIIN hMidiIn)
1212 dprintf_mmsys(stddeb, "midiInStart\n");
1213 return 0;
1216 /**************************************************************************
1217 * midiInStop [MMSYSTEM.310]
1219 UINT midiInStop(HMIDIIN hMidiIn)
1221 dprintf_mmsys(stddeb, "midiInStop\n");
1222 return 0;
1225 /**************************************************************************
1226 * midiInReset [MMSYSTEM.311]
1228 UINT midiInReset(HMIDIIN hMidiIn)
1230 dprintf_mmsys(stddeb, "midiInReset\n");
1231 return 0;
1234 /**************************************************************************
1235 * midiInGetID [MMSYSTEM.312]
1237 UINT midiInGetID(HMIDIIN hMidiIn, UINT FAR* lpuDeviceID)
1239 dprintf_mmsys(stddeb, "midiInGetID\n");
1240 return 0;
1243 /**************************************************************************
1244 * midiInMessage [MMSYSTEM.313]
1246 DWORD midiInMessage(HMIDIIN hMidiIn, UINT uMessage,
1247 DWORD dwParam1, DWORD dwParam2)
1249 LPMIDIOPENDESC lpDesc;
1250 dprintf_mmsys(stddeb, "midiInMessage(%04X, %04X, %08lX, %08lX)\n",
1251 hMidiIn, uMessage, dwParam1, dwParam2);
1252 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
1253 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1254 return midMessage(0, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
1258 /**************************************************************************
1259 * waveOutGetNumDevs [MMSYSTEM.401]
1261 UINT waveOutGetNumDevs()
1263 UINT count = 0;
1264 dprintf_mmsys(stddeb, "waveOutGetNumDevs\n");
1265 count += wodMessage(0, WODM_GETNUMDEVS, 0L, 0L, 0L);
1266 dprintf_mmsys(stddeb, "waveOutGetNumDevs return %u \n", count);
1267 return count;
1270 /**************************************************************************
1271 * waveOutGetDevCaps [MMSYSTEM.402]
1273 UINT waveOutGetDevCaps(UINT uDeviceID, WAVEOUTCAPS FAR* lpCaps, UINT uSize)
1275 dprintf_mmsys(stddeb, "waveOutGetDevCaps\n");
1276 return wodMessage(uDeviceID, WODM_GETDEVCAPS, 0L, (DWORD)lpCaps, uSize);
1279 /**************************************************************************
1280 * waveOutGetErrorText [MMSYSTEM.403]
1282 UINT waveOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
1284 dprintf_mmsys(stddeb, "waveOutGetErrorText\n");
1285 return(waveGetErrorText(uError, lpText, uSize));
1289 /**************************************************************************
1290 * waveGetErrorText [internal]
1292 UINT waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
1294 LPSTR msgptr;
1295 dprintf_mmsys(stddeb, "waveGetErrorText(%04X, %p, %d);\n", uError, lpText, uSize);
1296 if ((lpText == NULL) || (uSize < 1)) return(FALSE);
1297 lpText[0] = '\0';
1298 switch(uError) {
1299 case MMSYSERR_NOERROR:
1300 msgptr = "The specified command was carried out.";
1301 break;
1302 case MMSYSERR_ERROR:
1303 msgptr = "Undefined external error.";
1304 break;
1305 case MMSYSERR_BADDEVICEID:
1306 msgptr = "A device ID has been used that is out of range for your system.";
1307 break;
1308 case MMSYSERR_NOTENABLED:
1309 msgptr = "The driver was not enabled.";
1310 break;
1311 case MMSYSERR_ALLOCATED:
1312 msgptr = "The specified device is already in use. Wait until it is free, and then try again.";
1313 break;
1314 case MMSYSERR_INVALHANDLE:
1315 msgptr = "The specified device handle is invalid.";
1316 break;
1317 case MMSYSERR_NODRIVER:
1318 msgptr = "There is no driver installed on your system !\n";
1319 break;
1320 case MMSYSERR_NOMEM:
1321 msgptr = "Not enough memory available for this task. Quit one or more applications to increase available memory, and then try again.";
1322 break;
1323 case MMSYSERR_NOTSUPPORTED:
1324 msgptr = "This function is not supported. Use the Capabilities function to determine which functions and messages the driver supports.";
1325 break;
1326 case MMSYSERR_BADERRNUM:
1327 msgptr = "An error number was specified that is not defined in the system.";
1328 break;
1329 case MMSYSERR_INVALFLAG:
1330 msgptr = "An invalid flag was passed to a system function.";
1331 break;
1332 case MMSYSERR_INVALPARAM:
1333 msgptr = "An invalid parameter was passed to a system function.";
1334 break;
1335 case WAVERR_BADFORMAT:
1336 msgptr = "The specified format is not supported or cannot be translated. Use the Capabilities function to determine the supported formats";
1337 break;
1338 case WAVERR_STILLPLAYING:
1339 msgptr = "Cannot perform this operation while media data is still playing. Reset the device, or wait until the data is finished playing.";
1340 break;
1341 case WAVERR_UNPREPARED:
1342 msgptr = "The wave header was not prepared. Use the Prepare function to prepare the header, and then try again.";
1343 break;
1344 case WAVERR_SYNC:
1345 msgptr = "Cannot open the device without using the WAVE_ALLOWSYNC flag. Use the flag, and then try again.";
1346 break;
1347 default:
1348 msgptr = "Unknown MMSYSTEM Error !\n";
1349 break;
1351 lstrcpyn(lpText, msgptr, uSize);
1352 return TRUE;
1355 /**************************************************************************
1356 * waveOutOpen [MMSYSTEM.404]
1358 UINT waveOutOpen(HWAVEOUT FAR* lphWaveOut, UINT uDeviceID,
1359 const LPWAVEFORMAT lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
1361 HWAVE hWaveOut;
1362 LPWAVEOPENDESC lpDesc;
1363 LPWAVEOPENDESC lp16Desc;
1364 DWORD dwRet = 0;
1365 BOOL bMapperFlg = FALSE;
1366 dprintf_mmsys(stddeb, "waveOutOpen(%p, %d, %p, %08lX, %08lX, %08lX);\n",
1367 lphWaveOut, uDeviceID, lpFormat, dwCallback, dwInstance, dwFlags);
1368 if (dwFlags & WAVE_FORMAT_QUERY) {
1369 dprintf_mmsys(stddeb, "waveOutOpen // WAVE_FORMAT_QUERY requested !\n");
1371 if (uDeviceID == (UINT)WAVE_MAPPER) {
1372 dprintf_mmsys(stddeb, "waveOutOpen // WAVE_MAPPER mode requested !\n");
1373 bMapperFlg = TRUE;
1374 uDeviceID = 0;
1376 if (lpFormat == NULL) return WAVERR_BADFORMAT;
1377 hWaveOut = USER_HEAP_ALLOC(sizeof(WAVEOPENDESC));
1378 if (lphWaveOut != NULL) *lphWaveOut = hWaveOut;
1379 lp16Desc = (LPWAVEOPENDESC) USER_HEAP_SEG_ADDR(hWaveOut);
1380 lpDesc = (LPWAVEOPENDESC) PTR_SEG_TO_LIN(lp16Desc);
1381 if (lpDesc == NULL) return MMSYSERR_NOMEM;
1382 lpDesc->hWave = hWaveOut;
1383 lpDesc->lpFormat = lpFormat;
1384 lpDesc->dwCallBack = dwCallback;
1385 lpDesc->dwInstance = dwInstance;
1386 while(uDeviceID < MAXWAVEDRIVERS) {
1387 dwRet = wodMessage(uDeviceID, WODM_OPEN,
1388 lpDesc->dwInstance, (DWORD)lp16Desc, 0L);
1389 if (dwRet == MMSYSERR_NOERROR) break;
1390 if (!bMapperFlg) break;
1391 uDeviceID++;
1392 dprintf_mmsys(stddeb, "waveOutOpen // WAVE_MAPPER mode ! try next driver...\n");
1394 if (dwFlags & WAVE_FORMAT_QUERY) {
1395 dprintf_mmsys(stddeb, "waveOutOpen // End of WAVE_FORMAT_QUERY !\n");
1396 waveOutClose(hWaveOut);
1398 return dwRet;
1401 /**************************************************************************
1402 * waveOutClose [MMSYSTEM.405]
1404 UINT waveOutClose(HWAVEOUT hWaveOut)
1406 LPWAVEOPENDESC lpDesc;
1407 dprintf_mmsys(stddeb, "waveOutClose(%04X)\n", hWaveOut);
1408 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1409 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1410 return wodMessage(0, WODM_CLOSE, lpDesc->dwInstance, 0L, 0L);
1413 /**************************************************************************
1414 * waveOutPrepareHeader [MMSYSTEM.406]
1416 UINT waveOutPrepareHeader(HWAVEOUT hWaveOut,
1417 WAVEHDR FAR* lpWaveOutHdr, UINT uSize)
1419 LPWAVEOPENDESC lpDesc;
1420 dprintf_mmsys(stddeb, "waveOutPrepareHeader(%04X, %p, %u);\n",
1421 hWaveOut, lpWaveOutHdr, uSize);
1422 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1423 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1424 return wodMessage(0, WODM_PREPARE, lpDesc->dwInstance,
1425 (DWORD)lpWaveOutHdr, uSize);
1428 /**************************************************************************
1429 * waveOutUnprepareHeader [MMSYSTEM.407]
1431 UINT waveOutUnprepareHeader(HWAVEOUT hWaveOut,
1432 WAVEHDR FAR* lpWaveOutHdr, UINT uSize)
1434 LPWAVEOPENDESC lpDesc;
1435 dprintf_mmsys(stddeb, "waveOutUnprepareHeader(%04X, %p, %u);\n",
1436 hWaveOut, lpWaveOutHdr, uSize);
1437 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1438 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1439 return wodMessage(0, WODM_UNPREPARE, lpDesc->dwInstance,
1440 (DWORD)lpWaveOutHdr, uSize);
1443 /**************************************************************************
1444 * waveOutWrite [MMSYSTEM.408]
1446 UINT waveOutWrite(HWAVEOUT hWaveOut, WAVEHDR FAR* lpWaveOutHdr, UINT uSize)
1448 LPWAVEOPENDESC lpDesc;
1449 dprintf_mmsys(stddeb, "waveOutWrite(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
1450 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1451 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1452 return wodMessage(0, WODM_WRITE, lpDesc->dwInstance,
1453 (DWORD)lpWaveOutHdr, uSize);
1456 /**************************************************************************
1457 * waveOutPause [MMSYSTEM.409]
1459 UINT waveOutPause(HWAVEOUT hWaveOut)
1461 LPWAVEOPENDESC lpDesc;
1462 dprintf_mmsys(stddeb, "waveOutPause(%04X)\n", hWaveOut);
1463 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1464 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1465 return wodMessage(0, WODM_PAUSE, lpDesc->dwInstance, 0L, 0L);
1468 /**************************************************************************
1469 * waveOutRestart [MMSYSTEM.410]
1471 UINT waveOutRestart(HWAVEOUT hWaveOut)
1473 LPWAVEOPENDESC lpDesc;
1474 dprintf_mmsys(stddeb, "waveOutRestart(%04X)\n", hWaveOut);
1475 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1476 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1477 return wodMessage(0, WODM_RESTART, lpDesc->dwInstance, 0L, 0L);
1480 /**************************************************************************
1481 * waveOutReset [MMSYSTEM.411]
1483 UINT waveOutReset(HWAVEOUT hWaveOut)
1485 LPWAVEOPENDESC lpDesc;
1486 dprintf_mmsys(stddeb, "waveOutReset(%04X)\n", hWaveOut);
1487 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1488 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1489 return wodMessage(0, WODM_RESET, lpDesc->dwInstance, 0L, 0L);
1492 /**************************************************************************
1493 * waveOutGetPosition [MMSYSTEM.412]
1495 UINT waveOutGetPosition(HWAVEOUT hWaveOut, MMTIME FAR* lpTime, UINT uSize)
1497 LPWAVEOPENDESC lpDesc;
1498 dprintf_mmsys(stddeb, "waveOutGetPosition(%04X, %p, %u);\n", hWaveOut, lpTime, uSize);
1499 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1500 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1501 return wodMessage(0, WODM_GETPOS, lpDesc->dwInstance,
1502 (DWORD)lpTime, (DWORD)uSize);
1505 /**************************************************************************
1506 * waveOutGetPitch [MMSYSTEM.413]
1508 UINT waveOutGetPitch(HWAVEOUT hWaveOut, DWORD FAR* lpdwPitch)
1510 LPWAVEOPENDESC lpDesc;
1511 dprintf_mmsys(stddeb, "waveOutGetPitch(%04X, %p);\n", hWaveOut, lpdwPitch);
1512 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1513 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1514 return wodMessage(0, WODM_GETPITCH, lpDesc->dwInstance,
1515 (DWORD)lpdwPitch, 0L);
1518 /**************************************************************************
1519 * waveOutSetPitch [MMSYSTEM.414]
1521 UINT waveOutSetPitch(HWAVEOUT hWaveOut, DWORD dwPitch)
1523 LPWAVEOPENDESC lpDesc;
1524 dprintf_mmsys(stddeb, "waveOutSetPitch(%04X, %08lX);\n", hWaveOut, dwPitch);
1525 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1526 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1527 return wodMessage(0, WODM_SETPITCH, lpDesc->dwInstance, (DWORD)dwPitch, 0L);
1530 /**************************************************************************
1531 * waveOutGetVolume [MMSYSTEM.415]
1533 UINT waveOutGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume)
1535 dprintf_mmsys(stddeb, "waveOutGetVolume(%04X, %p);\n", uDeviceID, lpdwVolume);
1536 return wodMessage(uDeviceID, WODM_GETVOLUME, 0L, (DWORD)lpdwVolume, 0L);
1539 /**************************************************************************
1540 * waveOutSetVolume [MMSYSTEM.416]
1542 UINT waveOutSetVolume(UINT uDeviceID, DWORD dwVolume)
1544 dprintf_mmsys(stddeb, "waveOutSetVolume(%04X, %08lX);\n", uDeviceID, dwVolume);
1545 return wodMessage(uDeviceID, WODM_SETVOLUME, 0L, dwVolume, 0L);
1548 /**************************************************************************
1549 * waveOutGetPlaybackRate [MMSYSTEM.417]
1551 UINT waveOutGetPlaybackRate(HWAVEOUT hWaveOut, DWORD FAR* lpdwRate)
1553 LPWAVEOPENDESC lpDesc;
1554 dprintf_mmsys(stddeb, "waveOutGetPlaybackRate(%04X, %p);\n", hWaveOut, lpdwRate);
1555 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1556 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1557 return wodMessage(0, WODM_GETPLAYBACKRATE, lpDesc->dwInstance,
1558 (DWORD)lpdwRate, 0L);
1561 /**************************************************************************
1562 * waveOutSetPlaybackRate [MMSYSTEM.418]
1564 UINT waveOutSetPlaybackRate(HWAVEOUT hWaveOut, DWORD dwRate)
1566 LPWAVEOPENDESC lpDesc;
1567 dprintf_mmsys(stddeb, "waveOutSetPlaybackRate(%04X, %08lX);\n", hWaveOut, dwRate);
1568 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1569 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1570 return wodMessage(0, WODM_SETPLAYBACKRATE,
1571 lpDesc->dwInstance, (DWORD)dwRate, 0L);
1574 /**************************************************************************
1575 * waveOutBreakLoop [MMSYSTEM.419]
1577 UINT waveOutBreakLoop(HWAVEOUT hWaveOut)
1579 dprintf_mmsys(stddeb, "waveOutBreakLoop(%04X)\n", hWaveOut);
1580 return MMSYSERR_INVALHANDLE;
1583 /**************************************************************************
1584 * waveOutGetID [MMSYSTEM.420]
1586 UINT waveOutGetID(HWAVEOUT hWaveOut, UINT FAR* lpuDeviceID)
1588 LPWAVEOPENDESC lpDesc;
1589 dprintf_mmsys(stddeb, "waveOutGetID(%04X, %p);\n", hWaveOut, lpuDeviceID);
1590 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1591 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1592 if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
1594 *lpuDeviceID = lpParms->wDeviceID;
1596 return 0;
1599 /**************************************************************************
1600 * waveOutMessage [MMSYSTEM.421]
1602 DWORD waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage,
1603 DWORD dwParam1, DWORD dwParam2)
1605 LPWAVEOPENDESC lpDesc;
1606 dprintf_mmsys(stddeb, "waveOutMessage(%04X, %04X, %08lX, %08lX)\n",
1607 hWaveOut, uMessage, dwParam1, dwParam2);
1608 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
1609 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1610 return wodMessage(0, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
1613 /**************************************************************************
1614 * waveInGetNumDevs [MMSYSTEM.501]
1616 UINT waveInGetNumDevs()
1618 UINT count = 0;
1619 dprintf_mmsys(stddeb, "waveInGetNumDevs\n");
1620 count += widMessage(0, WIDM_GETNUMDEVS, 0L, 0L, 0L);
1621 dprintf_mmsys(stddeb, "waveInGetNumDevs return %u \n", count);
1622 return count;
1626 /**************************************************************************
1627 * waveInGetDevCaps [MMSYSTEM.502]
1629 UINT waveInGetDevCaps(UINT uDeviceID, WAVEINCAPS FAR* lpCaps, UINT uSize)
1631 dprintf_mmsys(stddeb, "waveInGetDevCaps\n");
1632 return widMessage(uDeviceID, WIDM_GETDEVCAPS, 0L, (DWORD)lpCaps, uSize);
1636 /**************************************************************************
1637 * waveInGetErrorText [MMSYSTEM.503]
1639 UINT waveInGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
1641 dprintf_mmsys(stddeb, "waveInGetErrorText\n");
1642 return(waveGetErrorText(uError, lpText, uSize));
1646 /**************************************************************************
1647 * waveInOpen [MMSYSTEM.504]
1649 UINT waveInOpen(HWAVEIN FAR* lphWaveIn, UINT uDeviceID,
1650 const LPWAVEFORMAT lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
1652 HWAVE hWaveIn;
1653 LPWAVEOPENDESC lpDesc;
1654 LPWAVEOPENDESC lp16Desc;
1655 DWORD dwRet = 0;
1656 BOOL bMapperFlg = FALSE;
1657 dprintf_mmsys(stddeb, "waveInOpen(%p, %d, %p, %08lX, %08lX, %08lX);\n",
1658 lphWaveIn, uDeviceID, lpFormat, dwCallback, dwInstance, dwFlags);
1659 if (dwFlags & WAVE_FORMAT_QUERY) {
1660 dprintf_mmsys(stddeb, "waveInOpen // WAVE_FORMAT_QUERY requested !\n");
1662 if (uDeviceID == (UINT)WAVE_MAPPER) {
1663 dprintf_mmsys(stddeb, "waveInOpen // WAVE_MAPPER mode requested !\n");
1664 bMapperFlg = TRUE;
1665 uDeviceID = 0;
1667 if (lpFormat == NULL) return WAVERR_BADFORMAT;
1668 hWaveIn = USER_HEAP_ALLOC(sizeof(WAVEOPENDESC));
1669 if (lphWaveIn != NULL) *lphWaveIn = hWaveIn;
1670 lp16Desc = (LPWAVEOPENDESC) USER_HEAP_SEG_ADDR(hWaveIn);
1671 lpDesc = (LPWAVEOPENDESC) PTR_SEG_TO_LIN(lp16Desc);
1672 if (lpDesc == NULL) return MMSYSERR_NOMEM;
1673 lpDesc->hWave = hWaveIn;
1674 lpDesc->lpFormat = lpFormat;
1675 lpDesc->dwCallBack = dwCallback;
1676 lpDesc->dwInstance = dwInstance;
1677 while(uDeviceID < MAXWAVEDRIVERS) {
1678 dwRet = widMessage(uDeviceID, WIDM_OPEN,
1679 lpDesc->dwInstance, (DWORD)lp16Desc, 0L);
1680 if (dwRet == MMSYSERR_NOERROR) break;
1681 if (!bMapperFlg) break;
1682 uDeviceID++;
1683 dprintf_mmsys(stddeb, "waveInOpen // WAVE_MAPPER mode ! try next driver...\n");
1685 if (dwFlags & WAVE_FORMAT_QUERY) {
1686 dprintf_mmsys(stddeb, "waveInOpen // End of WAVE_FORMAT_QUERY !\n");
1687 waveInClose(hWaveIn);
1689 return dwRet;
1693 /**************************************************************************
1694 * waveInClose [MMSYSTEM.505]
1696 UINT waveInClose(HWAVEIN hWaveIn)
1698 LPWAVEOPENDESC lpDesc;
1699 dprintf_mmsys(stddeb, "waveInClose(%04X)\n", hWaveIn);
1700 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
1701 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1702 return widMessage(0, WIDM_CLOSE, lpDesc->dwInstance, 0L, 0L);
1706 /**************************************************************************
1707 * waveInPrepareHeader [MMSYSTEM.506]
1709 UINT waveInPrepareHeader(HWAVEIN hWaveIn,
1710 WAVEHDR FAR* lpWaveInHdr, UINT uSize)
1712 LPWAVEOPENDESC lpDesc;
1713 LPWAVEHDR lp32WaveInHdr;
1714 dprintf_mmsys(stddeb, "waveInPrepareHeader(%04X, %p, %u);\n",
1715 hWaveIn, lpWaveInHdr, uSize);
1716 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
1717 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1718 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
1719 lp32WaveInHdr = PTR_SEG_TO_LIN(lpWaveInHdr);
1720 lp32WaveInHdr->lpNext = NULL;
1721 lp32WaveInHdr->dwBytesRecorded = 0;
1722 dprintf_mmsys(stddeb, "waveInPrepareHeader // lpData=%p size=%lu \n",
1723 lp32WaveInHdr->lpData, lp32WaveInHdr->dwBufferLength);
1724 return widMessage(0, WIDM_PREPARE, lpDesc->dwInstance,
1725 (DWORD)lpWaveInHdr, uSize);
1729 /**************************************************************************
1730 * waveInUnprepareHeader [MMSYSTEM.507]
1732 UINT waveInUnprepareHeader(HWAVEIN hWaveIn,
1733 WAVEHDR FAR* lpWaveInHdr, UINT uSize)
1735 LPWAVEOPENDESC lpDesc;
1736 LPWAVEHDR lp32WaveInHdr;
1737 dprintf_mmsys(stddeb, "waveInUnprepareHeader(%04X, %p, %u);\n",
1738 hWaveIn, lpWaveInHdr, uSize);
1739 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
1740 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1741 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
1742 lp32WaveInHdr = PTR_SEG_TO_LIN(lpWaveInHdr);
1743 USER_HEAP_FREE(HIWORD((DWORD)lp32WaveInHdr->lpData));
1744 lp32WaveInHdr->lpData = NULL;
1745 lp32WaveInHdr->lpNext = NULL;
1746 return widMessage(0, WIDM_UNPREPARE, lpDesc->dwInstance,
1747 (DWORD)lpWaveInHdr, uSize);
1751 /**************************************************************************
1752 * waveInAddBuffer [MMSYSTEM.508]
1754 UINT waveInAddBuffer(HWAVEIN hWaveIn,
1755 WAVEHDR FAR* lpWaveInHdr, UINT uSize)
1757 LPWAVEOPENDESC lpDesc;
1758 LPWAVEHDR lp32WaveInHdr;
1759 dprintf_mmsys(stddeb, "waveInAddBuffer(%04X, %p, %u);\n", hWaveIn, lpWaveInHdr, uSize);
1760 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
1761 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1762 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
1763 lp32WaveInHdr = PTR_SEG_TO_LIN(lpWaveInHdr);
1764 lp32WaveInHdr->lpNext = NULL;
1765 lp32WaveInHdr->dwBytesRecorded = 0;
1766 dprintf_mmsys(stddeb, "waveInAddBuffer // lpData=%p size=%lu \n",
1767 lp32WaveInHdr->lpData, lp32WaveInHdr->dwBufferLength);
1768 return widMessage(0, WIDM_ADDBUFFER, lpDesc->dwInstance,
1769 (DWORD)lpWaveInHdr, uSize);
1773 /**************************************************************************
1774 * waveInStart [MMSYSTEM.509]
1776 UINT waveInStart(HWAVEIN hWaveIn)
1778 LPWAVEOPENDESC lpDesc;
1779 dprintf_mmsys(stddeb, "waveInStart(%04X)\n", hWaveIn);
1780 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
1781 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1782 return widMessage(0, WIDM_START, lpDesc->dwInstance, 0L, 0L);
1786 /**************************************************************************
1787 * waveInStop [MMSYSTEM.510]
1789 UINT waveInStop(HWAVEIN hWaveIn)
1791 LPWAVEOPENDESC lpDesc;
1792 dprintf_mmsys(stddeb, "waveInStop(%04X)\n", hWaveIn);
1793 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
1794 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1795 return widMessage(0, WIDM_STOP, lpDesc->dwInstance, 0L, 0L);
1799 /**************************************************************************
1800 * waveInReset [MMSYSTEM.511]
1802 UINT waveInReset(HWAVEIN hWaveIn)
1804 LPWAVEOPENDESC lpDesc;
1805 dprintf_mmsys(stddeb, "waveInReset(%04X)\n", hWaveIn);
1806 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
1807 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1808 return widMessage(0, WIDM_RESET, lpDesc->dwInstance, 0L, 0L);
1812 /**************************************************************************
1813 * waveInGetPosition [MMSYSTEM.512]
1815 UINT waveInGetPosition(HWAVEIN hWaveIn, MMTIME FAR* lpTime, UINT uSize)
1817 LPWAVEOPENDESC lpDesc;
1818 dprintf_mmsys(stddeb, "waveInGetPosition(%04X, %p, %u);\n", hWaveIn, lpTime, uSize);
1819 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
1820 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1821 return widMessage(0, WIDM_GETPOS, lpDesc->dwInstance,
1822 (DWORD)lpTime, (DWORD)uSize);
1826 /**************************************************************************
1827 * waveInGetID [MMSYSTEM.513]
1829 UINT waveInGetID(HWAVEIN hWaveIn, UINT FAR* lpuDeviceID)
1831 dprintf_mmsys(stddeb, "waveInGetID\n");
1832 if (lpuDeviceID == NULL) return MMSYSERR_INVALPARAM;
1833 return 0;
1837 /**************************************************************************
1838 * waveInMessage [MMSYSTEM.514]
1840 DWORD waveInMessage(HWAVEIN hWaveIn, UINT uMessage,
1841 DWORD dwParam1, DWORD dwParam2)
1843 LPWAVEOPENDESC lpDesc;
1844 dprintf_mmsys(stddeb, "waveInMessage(%04X, %04X, %08lX, %08lX)\n",
1845 hWaveIn, uMessage, dwParam1, dwParam2);
1846 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
1847 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1848 return widMessage(0, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
1852 /**************************************************************************
1853 * mmioOpen [MMSYSTEM.1210]
1855 HMMIO mmioOpen(LPSTR szFileName, MMIOINFO FAR* lpmmioinfo, DWORD dwOpenFlags)
1857 int hFile;
1858 HANDLE hmmio;
1859 OFSTRUCT ofs;
1860 LPMMIOINFO lpmminfo;
1861 dprintf_mmsys(stddeb, "mmioOpen('%s', %p, %08lX);\n", szFileName, lpmmioinfo, dwOpenFlags);
1862 hFile = OpenFile(szFileName, &ofs, dwOpenFlags);
1863 if (hFile == -1) return 0;
1864 hmmio = GlobalAlloc(GMEM_MOVEABLE, sizeof(MMIOINFO));
1865 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1866 if (lpmminfo == NULL) return 0;
1867 memset(lpmminfo, 0, sizeof(MMIOINFO));
1868 lpmminfo->hmmio = hmmio;
1869 lpmminfo->dwReserved2 = MAKELONG(hFile, 0);
1870 GlobalUnlock(hmmio);
1871 dprintf_mmsys(stddeb, "mmioOpen // return hmmio=%04X\n", hmmio);
1872 return hmmio;
1876 /**************************************************************************
1877 * mmioClose [MMSYSTEM.1211]
1879 UINT mmioClose(HMMIO hmmio, UINT uFlags)
1881 LPMMIOINFO lpmminfo;
1882 dprintf_mmsys(stddeb, "mmioClose(%04X, %04X);\n", hmmio, uFlags);
1883 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1884 if (lpmminfo == NULL) return 0;
1885 _lclose(LOWORD(lpmminfo->dwReserved2));
1886 GlobalUnlock(hmmio);
1887 GlobalFree(hmmio);
1888 return 0;
1893 /**************************************************************************
1894 * mmioRead [MMSYSTEM.1212]
1896 LONG mmioRead(HMMIO hmmio, HPSTR pch, LONG cch)
1898 LONG count;
1899 LPMMIOINFO lpmminfo;
1900 dprintf_mmio(stddeb, "mmioRead(%04X, %p, %ld);\n", hmmio, pch, cch);
1901 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1902 if (lpmminfo == NULL) return 0;
1903 count = read(LOWORD(lpmminfo->dwReserved2), pch, cch);
1904 GlobalUnlock(hmmio);
1905 dprintf_mmio(stddeb, "mmioRead // count=%ld\n", count);
1906 return count;
1911 /**************************************************************************
1912 * mmioWrite [MMSYSTEM.1213]
1914 LONG mmioWrite(HMMIO hmmio, HPCSTR pch, LONG cch)
1916 LONG count;
1917 LPMMIOINFO lpmminfo;
1918 dprintf_mmsys(stddeb, "mmioWrite(%04X, %p, %ld);\n", hmmio, pch, cch);
1919 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1920 if (lpmminfo == NULL) return 0;
1921 count = _lwrite(LOWORD(lpmminfo->dwReserved2), (LPSTR)pch, cch);
1922 GlobalUnlock(hmmio);
1923 return count;
1926 /**************************************************************************
1927 * mmioSeek [MMSYSTEM.1214]
1929 LONG mmioSeek(HMMIO hmmio, LONG lOffset, int iOrigin)
1931 int count;
1932 LPMMIOINFO lpmminfo;
1933 dprintf_mmsys(stddeb, "mmioSeek(%04X, %08lX, %d);\n", hmmio, lOffset, iOrigin);
1934 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1935 if (lpmminfo == NULL) {
1936 dprintf_mmsys(stddeb, "mmioSeek // can't lock hmmio=%04X !\n", hmmio);
1937 return 0;
1939 count = _llseek(LOWORD(lpmminfo->dwReserved2), lOffset, iOrigin);
1940 GlobalUnlock(hmmio);
1941 return count;
1944 /**************************************************************************
1945 * mmioGetInfo [MMSYSTEM.1215]
1947 UINT mmioGetInfo(HMMIO hmmio, MMIOINFO FAR* lpmmioinfo, UINT uFlags)
1949 LPMMIOINFO lpmminfo;
1950 dprintf_mmsys(stddeb, "mmioGetInfo\n");
1951 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1952 if (lpmminfo == NULL) return 0;
1953 memcpy(lpmmioinfo, lpmminfo, sizeof(MMIOINFO));
1954 GlobalUnlock(hmmio);
1955 return 0;
1958 /**************************************************************************
1959 * mmioSetInfo [MMSYSTEM.1216]
1961 UINT mmioSetInfo(HMMIO hmmio, const MMIOINFO FAR* lpmmioinfo, UINT uFlags)
1963 LPMMIOINFO lpmminfo;
1964 dprintf_mmsys(stddeb, "mmioSetInfo\n");
1965 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1966 if (lpmminfo == NULL) return 0;
1967 GlobalUnlock(hmmio);
1968 return 0;
1971 /**************************************************************************
1972 * mmioSetBuffer [MMSYSTEM.1217]
1974 UINT mmioSetBuffer(HMMIO hmmio, LPSTR pchBuffer,
1975 LONG cchBuffer, UINT uFlags)
1977 dprintf_mmsys(stddeb, "mmioSetBuffer // empty stub \n");
1978 return 0;
1981 /**************************************************************************
1982 * mmioFlush [MMSYSTEM.1218]
1984 UINT mmioFlush(HMMIO hmmio, UINT uFlags)
1986 LPMMIOINFO lpmminfo;
1987 dprintf_mmsys(stddeb, "mmioFlush(%04X, %04X)\n", hmmio, uFlags);
1988 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1989 if (lpmminfo == NULL) return 0;
1990 GlobalUnlock(hmmio);
1991 return 0;
1994 /**************************************************************************
1995 * mmioAdvance [MMSYSTEM.1219]
1997 UINT mmioAdvance(HMMIO hmmio, MMIOINFO FAR* lpmmioinfo, UINT uFlags)
1999 int count = 0;
2000 LPMMIOINFO lpmminfo;
2001 dprintf_mmsys(stddeb, "mmioAdvance\n");
2002 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
2003 if (lpmminfo == NULL) return 0;
2004 if (uFlags == MMIO_READ) {
2005 count = read(LOWORD(lpmminfo->dwReserved2),
2006 lpmmioinfo->pchBuffer, lpmmioinfo->cchBuffer);
2008 if (uFlags == MMIO_WRITE) {
2009 count = _lwrite(LOWORD(lpmminfo->dwReserved2),
2010 lpmmioinfo->pchBuffer, lpmmioinfo->cchBuffer);
2012 lpmmioinfo->pchNext += count;
2013 GlobalUnlock(hmmio);
2014 lpmminfo->lDiskOffset = _llseek(LOWORD(lpmminfo->dwReserved2), 0, SEEK_CUR);
2015 return 0;
2018 /**************************************************************************
2019 * mmioStringToFOURCC [MMSYSTEM.1220]
2021 FOURCC mmioStringToFOURCC(LPCSTR sz, UINT uFlags)
2023 dprintf_mmsys(stddeb, "mmioStringToFOURCC // empty stub \n");
2024 return 0;
2027 /**************************************************************************
2028 * mmioInstallIOProc [MMSYSTEM.1221]
2030 LPMMIOPROC mmioInstallIOProc(FOURCC fccIOProc,
2031 LPMMIOPROC pIOProc, DWORD dwFlags)
2033 dprintf_mmsys(stddeb, "mmioInstallIOProc // empty stub \n");
2034 return 0;
2037 /**************************************************************************
2038 * mmioSendMessage [MMSYSTEM.1222]
2040 LRESULT mmioSendMessage(HMMIO hmmio, UINT uMessage,
2041 LPARAM lParam1, LPARAM lParam2)
2043 dprintf_mmsys(stddeb, "mmioSendMessage // empty stub \n");
2044 return 0;
2047 /**************************************************************************
2048 * mmioDescend [MMSYSTEM.1223]
2050 UINT mmioDescend(HMMIO hmmio, MMCKINFO FAR* lpck,
2051 const MMCKINFO FAR* lpckParent, UINT uFlags)
2053 DWORD dwfcc, dwOldPos;
2054 LPMMIOINFO lpmminfo;
2055 dprintf_mmio(stddeb, "mmioDescend(%04X, %p, %p, %04X);\n",
2056 hmmio, lpck, lpckParent, uFlags);
2057 if (lpck == NULL) return 0;
2058 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
2059 if (lpmminfo == NULL) return 0;
2060 dwfcc = lpck->ckid;
2061 dprintf_mmio(stddeb, "mmioDescend // dwfcc=%08lX\n", dwfcc);
2062 dwOldPos = _llseek(LOWORD(lpmminfo->dwReserved2), 0, SEEK_CUR);
2063 dprintf_mmio(stddeb, "mmioDescend // dwOldPos=%ld\n", dwOldPos);
2064 if (lpckParent != NULL) {
2065 dprintf_mmio(stddeb, "mmioDescend // seek inside parent at %ld !\n", lpckParent->dwDataOffset);
2066 dwOldPos = _llseek(LOWORD(lpmminfo->dwReserved2),
2067 lpckParent->dwDataOffset, SEEK_SET);
2069 if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDRIFF) ||
2070 (uFlags & MMIO_FINDLIST)) {
2071 dprintf_mmio(stddeb, "mmioDescend // MMIO_FINDxxxx dwfcc=%08lX !\n", dwfcc);
2072 while (TRUE) {
2073 if (read(LOWORD(lpmminfo->dwReserved2), (LPSTR)lpck,
2074 sizeof(MMCKINFO)) < sizeof(MMCKINFO)) {
2075 _llseek(LOWORD(lpmminfo->dwReserved2), dwOldPos, SEEK_SET);
2076 GlobalUnlock(hmmio);
2077 return MMIOERR_CHUNKNOTFOUND;
2079 dprintf_mmio(stddeb, "mmioDescend // dwfcc=%08lX ckid=%08lX cksize=%08lX !\n",
2080 dwfcc, lpck->ckid, lpck->cksize);
2081 if (dwfcc == lpck->ckid) break;
2082 dwOldPos += lpck->cksize + 2 * sizeof(DWORD);
2083 if (lpck->ckid == FOURCC_RIFF || lpck->ckid == FOURCC_LIST)
2084 dwOldPos += sizeof(DWORD);
2085 _llseek(LOWORD(lpmminfo->dwReserved2), dwOldPos, SEEK_SET);
2088 else {
2089 if (read(LOWORD(lpmminfo->dwReserved2), (LPSTR)lpck,
2090 sizeof(MMCKINFO)) < sizeof(MMCKINFO)) {
2091 _llseek(LOWORD(lpmminfo->dwReserved2), dwOldPos, SEEK_SET);
2092 GlobalUnlock(hmmio);
2093 return MMIOERR_CHUNKNOTFOUND;
2096 lpck->dwDataOffset = dwOldPos + 2 * sizeof(DWORD);
2097 if (lpck->ckid == FOURCC_RIFF || lpck->ckid == FOURCC_LIST)
2098 lpck->dwDataOffset += sizeof(DWORD);
2099 lpmminfo->lDiskOffset = _llseek(LOWORD(lpmminfo->dwReserved2),
2100 lpck->dwDataOffset, SEEK_SET);
2101 GlobalUnlock(hmmio);
2102 dprintf_mmio(stddeb, "mmioDescend // lpck->ckid=%08lX lpck->cksize=%ld !\n",
2103 lpck->ckid, lpck->cksize);
2104 dprintf_mmsys(stddeb, "mmioDescend // lpck->fccType=%08lX !\n", lpck->fccType);
2105 return 0;
2108 /**************************************************************************
2109 * mmioAscend [MMSYSTEM.1224]
2111 UINT mmioAscend(HMMIO hmmio, MMCKINFO FAR* lpck, UINT uFlags)
2113 dprintf_mmsys(stddeb, "mmioAscend // empty stub !\n");
2114 return 0;
2117 /**************************************************************************
2118 * mmioCreateChunk [MMSYSTEM.1225]
2120 UINT mmioCreateChunk(HMMIO hmmio, MMCKINFO FAR* lpck, UINT uFlags)
2122 dprintf_mmsys(stddeb, "mmioCreateChunk // empty stub \n");
2123 return 0;
2127 /**************************************************************************
2128 * mmioRename [MMSYSTEM.1226]
2130 UINT mmioRename(LPCSTR szFileName, LPCSTR szNewFileName,
2131 MMIOINFO FAR* lpmmioinfo, DWORD dwRenameFlags)
2133 dprintf_mmsys(stddeb, "mmioRename('%s', '%s', %p, %08lX); // empty stub \n",
2134 szFileName, szNewFileName, lpmmioinfo, dwRenameFlags);
2135 return 0;
2138 /**************************************************************************
2139 * DrvOpen [MMSYSTEM.1100]
2141 HDRVR DrvOpen(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
2143 dprintf_mmsys(stddeb, "DrvOpen('%s', '%s', %08lX);\n",
2144 lpDriverName, lpSectionName, lParam);
2145 return OpenDriver(lpDriverName, lpSectionName, lParam);
2149 /**************************************************************************
2150 * DrvClose [MMSYSTEM.1101]
2152 LRESULT DrvClose(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
2154 dprintf_mmsys(stddeb, "DrvClose(%04X, %08lX, %08lX);\n", hDrvr, lParam1, lParam2);
2155 return CloseDriver(hDrvr, lParam1, lParam2);
2159 /**************************************************************************
2160 * DrvSendMessage [MMSYSTEM.1102]
2162 LRESULT DrvSendMessage(HDRVR hDriver, WORD msg, LPARAM lParam1, LPARAM lParam2)
2164 DWORD dwDevID = 0;
2165 dprintf_mmsys(stddeb, "DrvSendMessage(%04X, %04X, %08lX, %08lX);\n",
2166 hDriver, msg, lParam1, lParam2);
2167 #ifndef WINELIB
2168 return CDAUDIO_DriverProc(dwDevID, hDriver, msg, lParam1, lParam2);
2169 #endif
2172 /**************************************************************************
2173 * DrvGetModuleHandle [MMSYSTEM.1103]
2175 HANDLE DrvGetModuleHandle(HDRVR hDrvr)
2177 dprintf_mmsys(stddeb, "DrvGetModuleHandle(%04X);\n", hDrvr);
2178 return 0;
2182 /**************************************************************************
2183 * DrvDefDriverProc [MMSYSTEM.1104]
2185 LRESULT DrvDefDriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
2186 DWORD dwParam1, DWORD dwParam2)
2188 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
2192 #endif /* #ifdef WINELIB */