4 * Copyright 1993 Martin Ayotte
6 /* FIXME: I think there are some segmented vs. linear pointer weirdnesses
7 * and long term pointers to 16 bit space in here
16 #include <sys/ioctl.h>
30 static int InstalledCount;
31 static int InstalledListLen;
32 static LPSTR lpInstallNames = NULL;
34 MCI_OPEN_DRIVER_PARMS mciDrv[MAXMCIDRIVERS];
35 /* struct below is to remember alias/devicenames for mcistring.c
36 * FIXME: should use some internal struct ...
38 MCI_OPEN_PARMS16 mciOpenDrv[MAXMCIDRIVERS];
40 UINT16 midiGetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize);
41 static UINT16 waveGetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize);
42 LONG WINAPI DrvDefDriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
43 DWORD dwParam1, DWORD dwParam2);
45 LONG WAVE_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
46 DWORD dwParam1, DWORD dwParam2);
47 LONG MIDI_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
48 DWORD dwParam1, DWORD dwParam2);
49 LONG CDAUDIO_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
50 DWORD dwParam1, DWORD dwParam2);
51 LONG ANIM_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
52 DWORD dwParam1, DWORD dwParam2);
55 #define GetDrv(wDevID) (&mciDrv[MMSYSTEM_DevIDToIndex(wDevID)])
56 #define GetOpenDrv(wDevID) (&mciOpenDrv[MMSYSTEM_DevIDToIndex(wDevID)])
58 /* The wDevID's returned by wine were originally in the range
59 * 0 - (MAXMCIDRIVERS - 1) and used directly as array indices.
60 * Unfortunately, ms-windows uses wDevID of zero to indicate
61 * errors. Now, multimedia drivers must pass the wDevID through
62 * MMSYSTEM_DevIDToIndex to get an index in that range. An
63 * aribtrary value, MMSYSTEM_MAGIC is added to the wDevID seen
64 * by the windows programs.
67 #define MMSYSTEM_MAGIC 0x0F00
69 /**************************************************************************
70 * MMSYSTEM_DevIDToIndex [internal]
72 int MMSYSTEM_DevIDToIndex(UINT16 wDevID) {
73 return wDevID - MMSYSTEM_MAGIC;
76 /**************************************************************************
77 * MMSYSTEM_FirstDevId [internal]
79 UINT16 MMSYSTEM_FirstDevID(void)
81 return MMSYSTEM_MAGIC;
84 /**************************************************************************
85 * MMSYSTEM_NextDevId [internal]
87 UINT16 MMSYSTEM_NextDevID(UINT16 wDevID) {
91 /**************************************************************************
92 * MMSYSTEM_DevIdValid [internal]
94 BOOL32 MMSYSTEM_DevIDValid(UINT16 wDevID) {
95 return wDevID >= 0x0F00 && wDevID < (0x0F00 + MAXMCIDRIVERS);
98 /**************************************************************************
99 * MMSYSTEM_WEP [MMSYSTEM.1]
101 int WINAPI MMSYSTEM_WEP(HINSTANCE16 hInstance, WORD wDataSeg,
102 WORD cbHeapSize, LPSTR lpCmdLine)
104 fprintf(stderr, "STUB: Unloading MMSystem DLL ... hInst=%04X \n", hInstance);
109 MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16,LPMMTIME32 mmt32) {
110 mmt16->wType = mmt32->wType;
111 /* layout of rest is the same for 32/16 */
112 memcpy(&(mmt32->u),&(mmt16->u),sizeof(mmt16->u));
116 MMSYSTEM_MMTIME16to32(LPMMTIME32 mmt32,LPMMTIME16 mmt16) {
117 mmt32->wType = mmt16->wType;
118 /* layout of rest is the same for 32/16,
119 * Note: mmt16->u is 2 bytes smaller than mmt32->u
121 memcpy(&(mmt16->u),&(mmt32->u),sizeof(mmt16->u));
124 /**************************************************************************
125 * PlaySoundA [WINMM.1]
127 BOOL32 WINAPI PlaySound32A(LPCSTR pszSound, HMODULE32 hmod, DWORD fdwSound)
129 dprintf_mmsys(stddeb, "PlaySoundA: pszSound='%s' hmod=%04X fdwSound=%08lX\n",
130 pszSound, hmod, fdwSound);
131 if(hmod != 0 || !(fdwSound & SND_FILENAME)) {
132 fprintf(stderr, "PlaySoundA: only disk sound files are supported\n");
136 bSound = sndPlaySound(pszSound, (UINT16) fdwSound);
137 return (BOOL32) bSound;
141 /**************************************************************************
142 * PlaySoundW [WINMM.18]
144 BOOL32 WINAPI PlaySound32W(LPCWSTR pszSound, HMODULE32 hmod, DWORD fdwSound)
146 LPSTR pszSoundA = HEAP_strdupWtoA(GetProcessHeap(),0,pszSound);
149 bSound = PlaySound32A(pszSoundA, hmod, fdwSound);
150 HeapFree(GetProcessHeap(),0,pszSoundA);
154 /**************************************************************************
155 * sndPlaySound [MMSYSTEM.2]
157 BOOL16 WINAPI sndPlaySound(LPCSTR lpszSoundName, UINT16 uFlags)
165 dprintf_mmsys(stddeb, "sndPlaySound // SoundName='%s' uFlags=%04X !\n",
166 lpszSoundName, uFlags);
167 if (lpszSoundName == NULL) {
168 dprintf_mmsys(stddeb, "sndPlaySound // Stop !\n");
171 hmmio = mmioOpen16((LPSTR)lpszSoundName, NULL,
172 MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
174 if (uFlags & SND_MEMORY) {
175 dprintf_mmsys(stddeb, "sndPlaySound // SND_MEMORY flag not implemented!\n");
181 dprintf_mmsys(stddeb, "sndPlaySound // searching in SystemSound List !\n");
182 GetProfileString32A("Sounds", (LPSTR)lpszSoundName, "", str, sizeof(str));
183 if (strlen(str) == 0) return FALSE;
184 if ( (ptr = (LPSTR)strchr(str, ',')) != NULL) *ptr = '\0';
185 hmmio = mmioOpen16(str, NULL, MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
188 dprintf_mmsys(stddeb, "sndPlaySound // can't find SystemSound='%s' !\n", str);
193 if (mmioDescend(hmmio, &ckMainRIFF, NULL, 0) == 0)
195 dprintf_mmsys(stddeb, "sndPlaySound // ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
196 (LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType, ckMainRIFF.cksize);
198 if ((ckMainRIFF.ckid == FOURCC_RIFF) &&
199 (ckMainRIFF.fccType == mmioFOURCC('W', 'A', 'V', 'E')))
203 mmckInfo.ckid = mmioFOURCC('f', 'm', 't', ' ');
205 if (mmioDescend(hmmio, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) == 0)
207 PCMWAVEFORMAT pcmWaveFormat;
209 dprintf_mmsys(stddeb, "sndPlaySound // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
210 (LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType, mmckInfo.cksize);
212 if (mmioRead(hmmio, (HPSTR) &pcmWaveFormat,
213 (long) sizeof(PCMWAVEFORMAT)) == (long) sizeof(PCMWAVEFORMAT))
216 dprintf_mmsys(stddeb, "sndPlaySound // wFormatTag=%04X !\n", pcmWaveFormat.wf.wFormatTag);
217 dprintf_mmsys(stddeb, "sndPlaySound // nChannels=%d \n", pcmWaveFormat.wf.nChannels);
218 dprintf_mmsys(stddeb, "sndPlaySound // nSamplesPerSec=%ld\n", pcmWaveFormat.wf.nSamplesPerSec);
219 dprintf_mmsys(stddeb, "sndPlaySound // nAvgBytesPerSec=%ld\n", pcmWaveFormat.wf.nAvgBytesPerSec);
220 dprintf_mmsys(stddeb, "sndPlaySound // nBlockAlign=%d \n", pcmWaveFormat.wf.nBlockAlign);
221 dprintf_mmsys(stddeb, "sndPlaySound // wBitsPerSample=%u !\n", pcmWaveFormat.wBitsPerSample);
223 mmckInfo.ckid = mmioFOURCC('d', 'a', 't', 'a');
224 if (mmioDescend(hmmio, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) == 0)
226 WAVEOPENDESC waveDesc;
229 dprintf_mmsys(stddeb, "sndPlaySound // Chunk Found \
230 ckid=%.4s fccType=%.4s cksize=%08lX \n", (LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType, mmckInfo.cksize);
232 pcmWaveFormat.wf.nAvgBytesPerSec = pcmWaveFormat.wf.nSamplesPerSec *
233 pcmWaveFormat.wf.nBlockAlign;
235 waveDesc.lpFormat = (LPWAVEFORMAT)&pcmWaveFormat;
237 dwRet = wodMessage( 0, WODM_OPEN, 0, (DWORD)&waveDesc, CALLBACK_NULL);
238 if (dwRet == MMSYSERR_NOERROR)
242 INT32 count, bufsize;
245 hData = GlobalAlloc16(GMEM_MOVEABLE, bufsize);
246 waveHdr.lpData = (LPSTR)GlobalLock16(hData);
247 waveHdr.dwBufferLength = bufsize;
249 waveHdr.dwFlags = 0L;
250 waveHdr.dwLoops = 0L;
252 dwRet = wodMessage(0,WODM_PREPARE,0,(DWORD)&waveHdr,sizeof(WAVEHDR));
253 if (dwRet == MMSYSERR_NOERROR)
257 count = mmioRead(hmmio, waveHdr.lpData, bufsize);
258 if (count < 1) break;
259 waveHdr.dwBufferLength = count;
260 /* waveHdr.dwBytesRecorded = count; */
261 /* FIXME: doesn't expect async ops */
262 wodMessage( 0, WODM_WRITE, 0, (DWORD)&waveHdr, sizeof(WAVEHDR));
264 wodMessage( 0, WODM_UNPREPARE, 0, (DWORD)&waveHdr, sizeof(WAVEHDR));
265 wodMessage( 0, WODM_CLOSE, 0, 0L, 0L);
269 else dprintf_mmsys(stddeb, "sndPlaySound // can't prepare WaveOut device !\n");
271 GlobalUnlock16(hData);
280 if (hmmio != 0) mmioClose(hmmio, 0);
284 /**************************************************************************
285 * mmsystemGetVersion [WINMM.134]
287 UINT32 WINAPI mmsystemGetVersion32()
289 return mmsystemGetVersion16();
292 /**************************************************************************
293 * mmsystemGetVersion [MMSYSTEM.5]
294 * return value borrowed from Win95 winmm.dll ;)
296 UINT16 WINAPI mmsystemGetVersion16()
298 dprintf_mmsys(stddeb, "mmsystemGetVersion // 3.10 (Win95?)\n");
302 /**************************************************************************
303 * DriverProc [MMSYSTEM.6]
305 LRESULT WINAPI DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
306 DWORD dwParam1, DWORD dwParam2)
308 return DrvDefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
311 /**************************************************************************
312 * DriverCallback [MMSYSTEM.31]
314 BOOL16 WINAPI DriverCallback(DWORD dwCallBack, UINT16 uFlags, HANDLE16 hDev,
315 WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
317 LPWAVEOPENDESC lpDesc;
319 dprintf_mmsys(stddeb, "DriverCallback(%08lX, %04X, %04X, %04X, %08lX, %08lX, %08lX); !\n",
320 dwCallBack, uFlags, hDev, wMsg, dwUser, dwParam1, dwParam2);
321 switch(uFlags & DCB_TYPEMASK) {
323 dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_NULL !\n");
326 dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_WINDOW = %04lX handle = %04X!\n",dwCallBack,hDev);
327 if (!IsWindow32(dwCallBack)) return FALSE;
328 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hDev);
329 if (lpDesc == NULL) return FALSE;
331 PostMessage16((HWND16)dwCallBack, wMsg, hDev, dwParam1);
334 dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_TASK !\n");
337 dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_FUNCTION !\n");
338 Callbacks->CallDriverCallback( (FARPROC16)dwCallBack,
340 dwParam1, dwParam2 );
346 /**************************************************************************
347 * Mixer devices. New to Win95
349 /**************************************************************************
350 * find out the real mixer ID depending on hmix (depends on dwFlags)
351 * FIXME: also fix dwInstance passing to mixMessage
353 static UINT32 _get_mixerID_from_handle(HMIXEROBJ32 hmix,DWORD dwFlags) {
354 /* FIXME: Check dwFlags for MIXER_OBJECTF_xxxx entries and modify hmix
355 * accordingly. For now we always use mixerdevice 0.
359 /**************************************************************************
360 * mixerGetNumDevs [WINMM.108]
362 UINT32 WINAPI mixerGetNumDevs32()
364 return mixerGetNumDevs16();
367 /**************************************************************************
370 UINT16 WINAPI mixerGetNumDevs16()
374 count = mixMessage(0,MXDM_GETNUMDEVS,0L,0L,0L);
375 dprintf_mmaux(stddeb,"mixerGetNumDevs returns %d\n",count);
379 /**************************************************************************
380 * mixerGetDevCapsW [WINMM.102]
382 UINT32 WINAPI mixerGetDevCaps32W(UINT32 devid,LPMIXERCAPS32W mixcaps,UINT32 size)
385 UINT32 ret = mixerGetDevCaps16(devid,&mic16,sizeof(mic16));
387 mixcaps->wMid = mic16.wMid;
388 mixcaps->wPid = mic16.wPid;
389 mixcaps->vDriverVersion = mic16.vDriverVersion;
390 lstrcpyAtoW(mixcaps->szPname,mic16.szPname);
391 mixcaps->fdwSupport = mic16.fdwSupport;
392 mixcaps->cDestinations = mic16.cDestinations;
395 /**************************************************************************
396 * mixerGetDevCaps [WINMM.101]
398 UINT32 WINAPI mixerGetDevCaps32A(UINT32 devid,LPMIXERCAPS32A mixcaps,UINT32 size)
401 UINT32 ret = mixerGetDevCaps16(devid,&mic16,sizeof(mic16));
403 mixcaps->wMid = mic16.wMid;
404 mixcaps->wPid = mic16.wPid;
405 mixcaps->vDriverVersion = mic16.vDriverVersion;
406 strcpy(mixcaps->szPname,mic16.szPname);
407 mixcaps->fdwSupport = mic16.fdwSupport;
408 mixcaps->cDestinations = mic16.cDestinations;
412 /**************************************************************************
415 UINT16 WINAPI mixerGetDevCaps16(UINT16 devid,LPMIXERCAPS16 mixcaps,UINT16 size)
417 fprintf(stderr,"mixerGetDevCaps!\n");
418 return mixMessage(devid,MXDM_GETDEVCAPS,0L,(DWORD)mixcaps,(DWORD)size);
421 /**************************************************************************
422 * mixerOpen [WINMM.110]
424 UINT32 WINAPI mixerOpen32(LPHMIXER32 lphmix,UINT32 uDeviceID,DWORD dwCallback,
425 DWORD dwInstance,DWORD fdwOpen)
430 fprintf(stderr,"mixerOpen32(%p,%d,%08lx,%08lx,%08lx)\n",
431 lphmix,uDeviceID,dwCallback,dwInstance,fdwOpen
433 ret = mixerOpen16(&hmix16,uDeviceID,dwCallback,dwInstance,fdwOpen);
434 if (lphmix) *lphmix = hmix16;
438 /**************************************************************************
441 UINT16 WINAPI mixerOpen16(LPHMIXER16 lphmix,UINT16 uDeviceID,DWORD dwCallback,
442 DWORD dwInstance,DWORD fdwOpen)
445 LPMIXEROPENDESC lpmod;
446 BOOL32 mapperflag = (uDeviceID==0);
449 fprintf(stderr,"mixerOpen(%p,%d,%08lx,%08lx,%08lx)\n",
450 lphmix,uDeviceID,dwCallback,dwInstance,fdwOpen
452 hmix = USER_HEAP_ALLOC(sizeof(MIXEROPENDESC));
453 if (lphmix) *lphmix = hmix;
454 lpmod = (LPMIXEROPENDESC)USER_HEAP_LIN_ADDR(hmix);
456 lpmod->dwCallback = dwCallback;
457 lpmod->dwInstance = dwInstance;
458 if (uDeviceID >= MAXMIXERDRIVERS)
460 while(uDeviceID < MAXMIXERDRIVERS) {
461 dwRet=mixMessage(uDeviceID,MXDM_OPEN,dwInstance,(DWORD)lpmod,fdwOpen);
462 if (dwRet == MMSYSERR_NOERROR) break;
463 if (!mapperflag) break;
466 lpmod->uDeviceID = uDeviceID;
470 /**************************************************************************
471 * mixerClose [WINMM.98]
473 UINT32 WINAPI mixerClose32(HMIXER32 hmix) {
474 return mixerClose16(hmix);
477 /**************************************************************************
480 UINT16 WINAPI mixerClose16(HMIXER16 hmix) {
481 LPMIXEROPENDESC lpmod;
483 fprintf(stderr,"mixerClose(%04x)\n",hmix);
484 lpmod = (LPMIXEROPENDESC)USER_HEAP_LIN_ADDR(hmix);
485 return mixMessage(lpmod->uDeviceID,MXDM_CLOSE,lpmod->dwInstance,0L,0L);
488 /**************************************************************************
489 * mixerGetID [WINMM.103]
491 UINT32 WINAPI mixerGetID32(HMIXEROBJ32 hmix,LPUINT32 lpid,DWORD fdwID) {
494 UINT32 ret = mixerGetID16(hmix,&xid,fdwID);
495 if (*lpid) *lpid = xid;
499 /**************************************************************************
502 UINT16 WINAPI mixerGetID16(HMIXEROBJ16 hmix,LPUINT16 lpid,DWORD fdwID) {
503 fprintf(stderr,"mixerGetID(%04x)\n",hmix);
504 return _get_mixerID_from_handle(hmix,fdwID);
507 /**************************************************************************
508 * mixerGetControlDetailsA [WINMM.99]
510 UINT32 mixerGetControlDetails32A(HMIXEROBJ32 hmix,LPMIXERCONTROLDETAILS32 lpmcd,DWORD fdwDetails) {
511 fprintf(stderr,"mixerGetControlDetails(%04x,%p,%08lx),stub!\n",
512 hmix,lpmcd,fdwDetails
514 return MMSYSERR_NOTENABLED;
517 /**************************************************************************
518 * mixerGetControlDetailsW [WINMM.100]
520 UINT32 mixerGetControlDetails32W(HMIXEROBJ32 hmix,LPMIXERCONTROLDETAILS32 lpmcd,DWORD fdwDetails) {
521 fprintf(stderr,"mixerGetControlDetails(%04x,%p,%08lx),stub!\n",
522 hmix,lpmcd,fdwDetails
524 return MMSYSERR_NOTENABLED;
527 /**************************************************************************
528 * mixerGetControlDetails [MMSYSTEM.808]
530 UINT16 mixerGetControlDetails16(HMIXEROBJ16 hmix,LPMIXERCONTROLDETAILS16 lpmcd,DWORD fdwDetails) {
531 fprintf(stderr,"mixerGetControlDetails(%04x,%p,%08lx),stub!\n",
532 hmix,lpmcd,fdwDetails
534 return MMSYSERR_NOTENABLED;
537 /**************************************************************************
538 * mixerGetLineControlsA [WINMM.104]
540 UINT32 mixerGetLineControls32A(HMIXEROBJ32 hmix,LPMIXERLINECONTROLS32A lpmlc,DWORD fdwControls) {
541 fprintf(stderr,"mixerGetLineControlsA(%04x,%p,%08lx),stub!\n",
542 hmix,lpmlc,fdwControls
544 return MMSYSERR_NOTENABLED;
547 /**************************************************************************
548 * mixerGetLineControlsW [WINMM.105]
550 UINT32 mixerGetLineControls32W(HMIXEROBJ32 hmix,LPMIXERLINECONTROLS32W lpmlc,DWORD fdwControls) {
551 fprintf(stderr,"mixerGetLineControlsA(%04x,%p,%08lx),stub!\n",
552 hmix,lpmlc,fdwControls
554 return MMSYSERR_NOTENABLED;
557 /**************************************************************************
558 * mixerGetLineControls [MMSYSTEM.807]
560 UINT16 mixerGetLineControls16(HMIXEROBJ16 hmix,LPMIXERLINECONTROLS16 lpmlc,DWORD fdwControls) {
561 fprintf(stderr,"mixerGetLineControls(%04x,%p,%08lx),stub!\n",
562 hmix,lpmlc,fdwControls
564 return MMSYSERR_NOTENABLED;
567 /**************************************************************************
568 * mixerGetLineInfoA [WINMM.106]
570 UINT32 mixerGetLineInfo32A(HMIXEROBJ32 hmix,LPMIXERLINE32A lpml,DWORD fdwInfo) {
574 ml16.dwDestination = lpml->dwDestination;
575 fprintf(stderr,"mixerGetLineInfoA(%04x,%p,%08lx),stub!\n",
578 ret = mixerGetLineInfo16(hmix,&ml16,fdwInfo);
579 lpml->cbStruct = sizeof(*lpml);
580 lpml->dwSource = ml16.dwSource;
581 lpml->dwLineID = ml16.dwLineID;
582 lpml->fdwLine = ml16.fdwLine;
583 lpml->dwUser = ml16.dwUser;
584 lpml->dwComponentType = ml16.dwComponentType;
585 lpml->cChannels = ml16.cChannels;
586 lpml->cConnections = ml16.cConnections;
587 lpml->cControls = ml16.cControls;
588 strcpy(lpml->szShortName,ml16.szShortName);
589 strcpy(lpml->szName,ml16.szName);
590 lpml->Target.dwType = ml16.Target.dwType;
591 lpml->Target.dwDeviceID = ml16.Target.dwDeviceID;
592 lpml->Target.wMid = ml16.Target.wMid;
593 lpml->Target.wPid = ml16.Target.wPid;
594 lpml->Target.vDriverVersion = ml16.Target.vDriverVersion;
595 strcpy(lpml->Target.szPname,ml16.Target.szPname);
599 /**************************************************************************
600 * mixerGetLineInfoW [WINMM.107]
602 UINT32 mixerGetLineInfo32W(HMIXEROBJ32 hmix,LPMIXERLINE32W lpml,DWORD fdwInfo) {
606 ml16.dwDestination = lpml->dwDestination;
607 fprintf(stderr,"mixerGetLineInfoW(%04x,%p,%08lx),stub!\n",
610 ret = mixerGetLineInfo16(hmix,&ml16,fdwInfo);
611 lpml->cbStruct = sizeof(*lpml);
612 lpml->dwSource = ml16.dwSource;
613 lpml->dwLineID = ml16.dwLineID;
614 lpml->fdwLine = ml16.fdwLine;
615 lpml->dwUser = ml16.dwUser;
616 lpml->dwComponentType = ml16.dwComponentType;
617 lpml->cChannels = ml16.cChannels;
618 lpml->cConnections = ml16.cConnections;
619 lpml->cControls = ml16.cControls;
620 lstrcpyAtoW(lpml->szShortName,ml16.szShortName);
621 lstrcpyAtoW(lpml->szName,ml16.szName);
622 lpml->Target.dwType = ml16.Target.dwType;
623 lpml->Target.dwDeviceID = ml16.Target.dwDeviceID;
624 lpml->Target.wMid = ml16.Target.wMid;
625 lpml->Target.wPid = ml16.Target.wPid;
626 lpml->Target.vDriverVersion = ml16.Target.vDriverVersion;
627 /*lstrcpyAtoW(lpml->Target.szPname,ml16.Target.szPname);*/
631 /**************************************************************************
632 * mixerGetLineInfo [MMSYSTEM.805]
634 UINT16 mixerGetLineInfo16(HMIXEROBJ16 hmix,LPMIXERLINE16 lpml,DWORD fdwInfo) {
635 UINT16 devid = _get_mixerID_from_handle(hmix,fdwInfo);
637 fprintf(stderr,"mixerGetLineInfo16(%04x,%p[line %08lx],%08lx)\n",
638 hmix,lpml,lpml->dwDestination,fdwInfo
640 return mixMessage(devid,MXDM_GETLINEINFO,0,(DWORD)lpml,fdwInfo);
643 /**************************************************************************
644 * mixerSetControlDetails [WINMM.111]
646 UINT32 mixerSetControlDetails32(HMIXEROBJ32 hmix,LPMIXERCONTROLDETAILS32 lpmcd,DWORD fdwDetails) {
647 fprintf(stderr,"mixerSetControlDetails32(%04x,%p,%08lx),stub!\n",
648 hmix,lpmcd,fdwDetails
650 return MMSYSERR_NOTENABLED;
653 /**************************************************************************
654 * mixerSetControlDetails [MMSYSTEM.809]
656 UINT16 mixerSetControlDetails16(HMIXEROBJ16 hmix,LPMIXERCONTROLDETAILS16 lpmcd,DWORD fdwDetails) {
657 fprintf(stderr,"mixerSetControlDetails16(%04x,%p,%08lx),stub!\n",
658 hmix,lpmcd,fdwDetails
660 return MMSYSERR_NOTENABLED;
663 /**************************************************************************
664 * mixerMessage [WINMM.109]
666 UINT32 mixerMessage32(HMIXER32 hmix,UINT32 uMsg,DWORD dwParam1,DWORD dwParam2) {
667 LPMIXEROPENDESC lpmod;
670 lpmod = (LPMIXEROPENDESC)USER_HEAP_LIN_ADDR(hmix);
672 uDeviceID = lpmod->uDeviceID;
675 fprintf(stderr,"mixerMessage(%04lx,%d,%08lx,%08lx)\n",(DWORD)hmix,uMsg,dwParam1,dwParam2);
676 return mixMessage(uDeviceID,uMsg,0L,dwParam1,dwParam2);
679 /**************************************************************************
680 * mixerMessage [MMSYSTEM.804]
682 UINT16 mixerMessage16(HMIXER16 hmix,UINT16 uMsg,DWORD dwParam1,DWORD dwParam2) {
683 LPMIXEROPENDESC lpmod;
686 lpmod = (LPMIXEROPENDESC)USER_HEAP_LIN_ADDR(hmix);
688 uDeviceID = lpmod->uDeviceID;
691 fprintf(stderr,"mixerMessage(%04x,%d,%08lx,%08lx)\n",hmix,uMsg,dwParam1,dwParam2);
692 return mixMessage(uDeviceID,uMsg,0L,dwParam1,dwParam2);
695 /**************************************************************************
696 * auxGetNumDevs [WINMM.22]
698 UINT32 WINAPI auxGetNumDevs32()
700 return auxGetNumDevs16();
703 /**************************************************************************
704 * auxGetNumDevs [MMSYSTEM.350]
706 UINT16 WINAPI auxGetNumDevs16()
709 dprintf_mmsys(stddeb, "auxGetNumDevs !\n");
710 count += auxMessage(0, AUXDM_GETNUMDEVS, 0L, 0L, 0L);
711 dprintf_mmsys(stddeb, "auxGetNumDevs return %u \n", count);
715 /**************************************************************************
716 * auxGetDevCaps [WINMM.20]
718 UINT32 WINAPI auxGetDevCaps32W(UINT32 uDeviceID,LPAUXCAPS32W lpCaps,UINT32 uSize)
721 UINT32 ret = auxGetDevCaps16(uDeviceID,&ac16,sizeof(ac16));
723 lpCaps->wMid = ac16.wMid;
724 lpCaps->wPid = ac16.wPid;
725 lpCaps->vDriverVersion = ac16.vDriverVersion;
726 lstrcpyAtoW(lpCaps->szPname,ac16.szPname);
727 lpCaps->wTechnology = ac16.wTechnology;
728 lpCaps->dwSupport = ac16.dwSupport;
732 /**************************************************************************
733 * auxGetDevCaps [WINMM.21]
735 UINT32 WINAPI auxGetDevCaps32A(UINT32 uDeviceID,LPAUXCAPS32A lpCaps,UINT32 uSize)
738 UINT32 ret = auxGetDevCaps16(uDeviceID,&ac16,sizeof(ac16));
740 lpCaps->wMid = ac16.wMid;
741 lpCaps->wPid = ac16.wPid;
742 lpCaps->vDriverVersion = ac16.vDriverVersion;
743 strcpy(lpCaps->szPname,ac16.szPname);
744 lpCaps->wTechnology = ac16.wTechnology;
745 lpCaps->dwSupport = ac16.dwSupport;
749 /**************************************************************************
750 * auxGetDevCaps [MMSYSTEM.351]
752 UINT16 WINAPI auxGetDevCaps16(UINT16 uDeviceID,LPAUXCAPS16 lpCaps, UINT16 uSize)
754 dprintf_mmsys(stddeb, "auxGetDevCaps(%04X, %p, %d) !\n",
755 uDeviceID, lpCaps, uSize);
756 return auxMessage(uDeviceID, AUXDM_GETDEVCAPS,
757 0L, (DWORD)lpCaps, (DWORD)uSize);
760 /**************************************************************************
761 * auxGetVolume [WINM.23]
763 UINT32 WINAPI auxGetVolume32(UINT32 uDeviceID, DWORD * lpdwVolume)
765 return auxGetVolume16(uDeviceID,lpdwVolume);
768 /**************************************************************************
769 * auxGetVolume [MMSYSTEM.352]
771 UINT16 WINAPI auxGetVolume16(UINT16 uDeviceID, DWORD * lpdwVolume)
773 dprintf_mmsys(stddeb, "auxGetVolume(%04X, %p) !\n", uDeviceID, lpdwVolume);
774 return auxMessage(uDeviceID, AUXDM_GETVOLUME, 0L, (DWORD)lpdwVolume, 0L);
777 /**************************************************************************
778 * auxSetVolume [WINMM.25]
780 UINT32 WINAPI auxSetVolume32(UINT32 uDeviceID, DWORD dwVolume)
782 return auxSetVolume16(uDeviceID,dwVolume);
785 /**************************************************************************
786 * auxSetVolume [MMSYSTEM.353]
788 UINT16 WINAPI auxSetVolume16(UINT16 uDeviceID, DWORD dwVolume)
790 dprintf_mmsys(stddeb, "auxSetVolume(%04X, %08lX) !\n", uDeviceID, dwVolume);
791 return auxMessage(uDeviceID, AUXDM_SETVOLUME, 0L, dwVolume, 0L);
794 /**************************************************************************
795 * auxOutMessage [MMSYSTEM.354]
797 DWORD WINAPI auxOutMessage32(UINT32 uDeviceID,UINT32 uMessage,DWORD dw1,DWORD dw2)
800 case AUXDM_GETNUMDEVS:
801 case AUXDM_GETVOLUME:
802 case AUXDM_SETVOLUME:
803 /* no argument conversion needed */
805 case AUXDM_GETDEVCAPS:
806 return auxGetDevCaps32A(uDeviceID,(LPAUXCAPS32A)dw1,dw2);
808 fprintf(stderr,"unhandled auxMessage32(%04x,%04x,%08lx,%08lx)\n",
809 uDeviceID,uMessage,dw1,dw2
813 return auxMessage(uDeviceID,uMessage,0L,dw1,dw2);
816 /**************************************************************************
817 * auxOutMessage [MMSYSTEM.354]
819 DWORD WINAPI auxOutMessage16(UINT16 uDeviceID, UINT16 uMessage, DWORD dw1, DWORD dw2)
821 dprintf_mmsys(stddeb, "auxOutMessage(%04X, %04X, %08lX, %08lX)\n",
822 uDeviceID, uMessage, dw1, dw2);
824 case AUXDM_GETNUMDEVS:
825 case AUXDM_SETVOLUME:
826 /* no argument conversion needed */
828 case AUXDM_GETVOLUME:
829 return auxGetVolume16(uDeviceID,(LPDWORD)PTR_SEG_TO_LIN(dw1));
830 case AUXDM_GETDEVCAPS:
831 return auxGetDevCaps16(uDeviceID,(LPAUXCAPS16)PTR_SEG_TO_LIN(dw1),dw2);
833 fprintf(stderr,"unhandled auxMessage32(%04x,%04x,%08lx,%08lx)\n",
834 uDeviceID,uMessage,dw1,dw2
838 return auxMessage(uDeviceID, uMessage, 0L, dw1, dw2);
841 /**************************************************************************
842 * mciGetErrorStringW [WINMM.46]
844 BOOL32 WINAPI mciGetErrorString32W(DWORD wError,LPWSTR lpstrBuffer,UINT32 uLength)
846 LPSTR bufstr = HeapAlloc(GetProcessHeap(),0,uLength);
847 BOOL32 ret = mciGetErrorString32A(wError,bufstr,uLength);
849 lstrcpyAtoW(lpstrBuffer,bufstr);
850 HeapFree(GetProcessHeap(),0,bufstr);
854 /**************************************************************************
855 * mciGetErrorStringA [WINMM.45]
857 BOOL32 WINAPI mciGetErrorString32A(DWORD wError,LPSTR lpstrBuffer,UINT32 uLength)
859 return mciGetErrorString16(wError,lpstrBuffer,uLength);
862 /**************************************************************************
863 * mciGetErrorString [MMSYSTEM.706]
865 BOOL16 WINAPI mciGetErrorString16(DWORD wError,LPSTR lpstrBuffer,UINT16 uLength)
868 dprintf_mmsys(stddeb, "mciGetErrorString(%08lX, %p, %d);\n", wError, lpstrBuffer, uLength);
869 if ((lpstrBuffer == NULL) || (uLength < 1)) return(FALSE);
870 lpstrBuffer[0] = '\0';
872 case MCIERR_INVALID_DEVICE_ID:
873 msgptr = "Invalid MCI device ID. Use the ID returned when opening the MCI device.";
875 case MCIERR_UNRECOGNIZED_KEYWORD:
876 msgptr = "The driver cannot recognize the specified command parameter.";
878 case MCIERR_UNRECOGNIZED_COMMAND:
879 msgptr = "The driver cannot recognize the specified command.";
881 case MCIERR_HARDWARE:
882 msgptr = "There is a problem with your media device. Make sure it is working correctly or contact the device manufacturer.";
884 case MCIERR_INVALID_DEVICE_NAME:
885 msgptr = "The specified device is not open or is not recognized by MCI.";
887 case MCIERR_OUT_OF_MEMORY:
888 msgptr = "Not enough memory available for this task. \nQuit one or more applications to increase available memory, and then try again.";
890 case MCIERR_DEVICE_OPEN:
891 msgptr = "The device name is already being used as an alias by this application. Use a unique alias.";
893 case MCIERR_CANNOT_LOAD_DRIVER:
894 msgptr = "There is an undetectable problem in loading the specified device driver.";
896 case MCIERR_MISSING_COMMAND_STRING:
897 msgptr = "No command was specified.";
899 case MCIERR_PARAM_OVERFLOW:
900 msgptr = "The output string was to large to fit in the return buffer. Increase the size of the buffer.";
902 case MCIERR_MISSING_STRING_ARGUMENT:
903 msgptr = "The specified command requires a character-string parameter. Please provide one.";
905 case MCIERR_BAD_INTEGER:
906 msgptr = "The specified integer is invalid for this command.";
908 case MCIERR_PARSER_INTERNAL:
909 msgptr = "The device driver returned an invalid return type. Check with the device manufacturer about obtaining a new driver.";
911 case MCIERR_DRIVER_INTERNAL:
912 msgptr = "There is a problem with the device driver. Check with the device manufacturer about obtaining a new driver.";
914 case MCIERR_MISSING_PARAMETER:
915 msgptr = "The specified command requires a parameter. Please supply one.";
917 case MCIERR_UNSUPPORTED_FUNCTION:
918 msgptr = "The MCI device you are using does not support the specified command.";
920 case MCIERR_FILE_NOT_FOUND:
921 msgptr = "Cannot find the specified file. Make sure the path and filename are correct.";
923 case MCIERR_DEVICE_NOT_READY:
924 msgptr = "The device driver is not ready.";
926 case MCIERR_INTERNAL:
927 msgptr = "A problem occurred in initializing MCI. Try restarting Windows.";
930 msgptr = "There is a problem with the device driver. The driver has closed. Cannot access error.";
932 case MCIERR_CANNOT_USE_ALL:
933 msgptr = "Cannot use 'all' as the device name with the specified command.";
935 case MCIERR_MULTIPLE:
936 msgptr = "Errors occurred in more than one device. Specify each command and device separately to determine which devices caused the error";
938 case MCIERR_EXTENSION_NOT_FOUND:
939 msgptr = "Cannot determine the device type from the given filename extension.";
941 case MCIERR_OUTOFRANGE:
942 msgptr = "The specified parameter is out of range for the specified command.";
944 case MCIERR_FLAGS_NOT_COMPATIBLE:
945 msgptr = "The specified parameters cannot be used together.";
947 case MCIERR_FILE_NOT_SAVED:
948 msgptr = "Cannot save the specified file. Make sure you have enough disk space or are still connected to the network.";
950 case MCIERR_DEVICE_TYPE_REQUIRED:
951 msgptr = "Cannot find the specified device. Make sure it is installed or that the device name is spelled correctly.";
953 case MCIERR_DEVICE_LOCKED:
954 msgptr = "The specified device is now being closed. Wait a few seconds, and then try again.";
956 case MCIERR_DUPLICATE_ALIAS:
957 msgptr = "The specified alias is already being used in this application. Use a unique alias.";
959 case MCIERR_BAD_CONSTANT:
960 msgptr = "The specified parameter is invalid for this command.";
962 case MCIERR_MUST_USE_SHAREABLE:
963 msgptr = "The device driver is already in use. To share it, use the 'shareable' parameter with each 'open' command.";
965 case MCIERR_MISSING_DEVICE_NAME:
966 msgptr = "The specified command requires an alias, file, driver, or device name. Please supply one.";
968 case MCIERR_BAD_TIME_FORMAT:
969 msgptr = "The specified value for the time format is invalid. Refer to the MCI documentation for valid formats.";
971 case MCIERR_NO_CLOSING_QUOTE:
972 msgptr = "A closing double-quotation mark is missing from the parameter value. Please supply one.";
974 case MCIERR_DUPLICATE_FLAGS:
975 msgptr = "A parameter or value was specified twice. Only specify it once.";
977 case MCIERR_INVALID_FILE:
978 msgptr = "The specified file cannot be played on the specified MCI device. The file may be corrupt, or not in the correct format.";
980 case MCIERR_NULL_PARAMETER_BLOCK:
981 msgptr = "A null parameter block was passed to MCI.";
983 case MCIERR_UNNAMED_RESOURCE:
984 msgptr = "Cannot save an unnamed file. Supply a filename.";
986 case MCIERR_NEW_REQUIRES_ALIAS:
987 msgptr = "You must specify an alias when using the 'new' parameter.";
989 case MCIERR_NOTIFY_ON_AUTO_OPEN:
990 msgptr = "Cannot use the 'notify' flag with auto-opened devices.";
992 case MCIERR_NO_ELEMENT_ALLOWED:
993 msgptr = "Cannot use a filename with the specified device.";
995 case MCIERR_NONAPPLICABLE_FUNCTION:
996 msgptr = "Cannot carry out the commands in the order specified. Correct the command sequence, and then try again.";
998 case MCIERR_ILLEGAL_FOR_AUTO_OPEN:
999 msgptr = "Cannot carry out the specified command on an auto-opened device. Wait until the device is closed, and then try again.";
1001 case MCIERR_FILENAME_REQUIRED:
1002 msgptr = "The filename is invalid. Make sure the filename is not longer than 8 characters, followed by a period and an extension.";
1004 case MCIERR_EXTRA_CHARACTERS:
1005 msgptr = "Cannot specify extra characters after a string enclosed in quotation marks.";
1007 case MCIERR_DEVICE_NOT_INSTALLED:
1008 msgptr = "The specified device is not installed on the system. Use the Drivers option in Control Panel to install the device.";
1011 msgptr = "Cannot access the specified file or MCI device. Try changing directories or restarting your computer.";
1014 msgptr = "Cannot access the specified file or MCI device because the application cannot change directories.";
1016 case MCIERR_SET_DRIVE:
1017 msgptr = "Cannot access specified file or MCI device because the application cannot change drives.";
1019 case MCIERR_DEVICE_LENGTH:
1020 msgptr = "Specify a device or driver name that is less than 79 characters.";
1022 case MCIERR_DEVICE_ORD_LENGTH:
1023 msgptr = "Specify a device or driver name that is less than 69 characters.";
1025 case MCIERR_NO_INTEGER:
1026 msgptr = "The specified command requires an integer parameter. Please provide one.";
1028 case MCIERR_WAVE_OUTPUTSINUSE:
1029 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.";
1031 case MCIERR_WAVE_SETOUTPUTINUSE:
1032 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.";
1034 case MCIERR_WAVE_INPUTSINUSE:
1035 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.";
1037 case MCIERR_WAVE_SETINPUTINUSE:
1038 msgptr = "Cannot set the current wave device for recording because it is in use. Wait until the device is free, and then try again.";
1040 case MCIERR_WAVE_OUTPUTUNSPECIFIED:
1041 msgptr = "Any compatible waveform playback device may be used.";
1043 case MCIERR_WAVE_INPUTUNSPECIFIED:
1044 msgptr = "Any compatible waveform recording device may be used.";
1046 case MCIERR_WAVE_OUTPUTSUNSUITABLE:
1047 msgptr = "No wave device that can play files in the current format is installed. Use the Drivers option to install the wave device.";
1049 case MCIERR_WAVE_SETOUTPUTUNSUITABLE:
1050 msgptr = "The device you are trying to play to cannot recognize the current file format.";
1052 case MCIERR_WAVE_INPUTSUNSUITABLE:
1053 msgptr = "No wave device that can record files in the current format is installed. Use the Drivers option to install the wave device.";
1055 case MCIERR_WAVE_SETINPUTUNSUITABLE:
1056 msgptr = "The device you are trying to record from cannot recognize the current file format.";
1058 case MCIERR_NO_WINDOW:
1059 msgptr = "There is no display window.";
1061 case MCIERR_CREATEWINDOW:
1062 msgptr = "Could not create or use window.";
1064 case MCIERR_FILE_READ:
1065 msgptr = "Cannot read the specified file. Make sure the file is still present, or check your disk or network connection.";
1067 case MCIERR_FILE_WRITE:
1068 msgptr = "Cannot write to the specified file. Make sure you have enough disk space or are still connected to the network.";
1070 case MCIERR_SEQ_DIV_INCOMPATIBLE:
1071 msgptr = "The time formats of the \"song pointer\" and SMPTE are mutually exclusive. You can't use them together.";
1073 case MCIERR_SEQ_NOMIDIPRESENT:
1074 msgptr = "The system has no installed MIDI devices. Use the Drivers option from the Control Panel to install a MIDI driver.";
1076 case MCIERR_SEQ_PORT_INUSE:
1077 msgptr = "The specified MIDI port is already in use. Wait until it is free; the try again.";
1079 case MCIERR_SEQ_PORT_MAPNODEVICE:
1080 msgptr = "The current MIDI Mapper setup refers to a MIDI device that is not installed on the system. Use the MIDI Mapper option from the Control Panel to edit the setup.";
1082 case MCIERR_SEQ_PORT_MISCERROR:
1083 msgptr = "An error occurred with the specified port.";
1085 case MCIERR_SEQ_PORT_NONEXISTENT:
1086 msgptr = "The specified MIDI device is not installed on the system. Use the Drivers option from the Control Panel to install a MIDI device.";
1088 case MCIERR_SEQ_PORTUNSPECIFIED:
1089 msgptr = "The system doesnot have a current MIDI port specified.";
1091 case MCIERR_SEQ_TIMER:
1092 msgptr = "All multimedia timers are being used by other applications. Quit one of these applications; then, try again.";
1097 msg# 514 : videodisc
1102 msg# 519 : animation
1103 msg# 520 : digitalvideo
1105 msg# 522 : waveaudio
1106 msg# 523 : sequencer
1107 msg# 524 : not ready
1110 msg# 527 : recording
1116 msg# 533 : milliseconds
1123 msg# 540 : smpte 30 drop
1129 msgptr = "Unknown MCI Error !\n";
1132 lstrcpyn32A(lpstrBuffer, msgptr, uLength);
1133 dprintf_mmsys(stddeb, "mciGetErrorString // msg = %s;\n", msgptr);
1138 /**************************************************************************
1139 * mciDriverNotify [MMSYSTEM.711]
1141 BOOL16 WINAPI mciDriverNotify(HWND16 hWndCallBack, UINT16 wDevID, UINT16 wStatus)
1143 dprintf_mmsys(stddeb, "mciDriverNotify(%04X, %u, %04X)\n", hWndCallBack, wDevID, wStatus);
1144 if (!IsWindow32(hWndCallBack)) return FALSE;
1145 dprintf_mmsys(stddeb, "mciDriverNotify // before PostMessage\n");
1146 PostMessage16( hWndCallBack, MM_MCINOTIFY, wStatus,
1147 MAKELONG(wDevID, 0));
1151 /**************************************************************************
1152 * mciOpen [internal]
1155 DWORD mciOpen(DWORD dwParam, LPMCI_OPEN_PARMS16 lp16Parms)
1158 LPMCI_OPEN_PARMS16 lpParms;
1160 UINT16 wDevID = MMSYSTEM_FirstDevID();
1163 lpParms = PTR_SEG_TO_LIN(lp16Parms);
1164 dprintf_mmsys(stddeb, "mciOpen(%08lX, %p (%p))\n", dwParam, lp16Parms, lpParms);
1165 if (lp16Parms == NULL) return MCIERR_INTERNAL;
1167 while(GetDrv(wDevID)->wType != 0) {
1168 wDevID = MMSYSTEM_NextDevID(wDevID);
1169 if (!MMSYSTEM_DevIDValid(wDevID)) {
1170 dprintf_mmsys(stddeb, "MCI_OPEN // MAXMCIDRIVERS reached !\n");
1171 return MCIERR_INTERNAL;
1174 dprintf_mmsys(stddeb, "mciOpen // wDevID=%04X \n", wDevID);
1175 memcpy(GetOpenDrv(wDevID),lpParms,sizeof(*lpParms));
1177 if (dwParam & MCI_OPEN_ELEMENT) {
1180 dprintf_mmsys(stddeb,"mciOpen // lpstrElementName='%s'\n",
1181 (char*)PTR_SEG_TO_LIN(lpParms->lpstrElementName)
1183 s=(char*)PTR_SEG_TO_LIN(lpParms->lpstrElementName);
1186 GetProfileString32A("mci extensions",t+1,"*",str,sizeof(str));
1188 dprintf_mmsys(stddeb, "mciOpen // str = %s \n", str);
1189 if (strcmp(str, "CDAUDIO") == 0) {
1190 uDevTyp = MCI_DEVTYPE_CD_AUDIO;
1192 if (strcmp(str, "WAVEAUDIO") == 0) {
1193 uDevTyp = MCI_DEVTYPE_WAVEFORM_AUDIO;
1195 if (strcmp(str, "SEQUENCER") == 0) {
1196 uDevTyp = MCI_DEVTYPE_SEQUENCER;
1198 if (strcmp(str, "ANIMATION1") == 0) {
1199 uDevTyp = MCI_DEVTYPE_ANIMATION;
1201 if (strcmp(str, "AVIVIDEO") == 0) {
1202 uDevTyp = MCI_DEVTYPE_DIGITAL_VIDEO;
1204 if (strcmp(str,"*") == 0) {
1205 dprintf_mmsys(stddeb,"No [mci extensions] entry for %s found.\n",t);
1206 return MCIERR_EXTENSION_NOT_FOUND;
1208 dprintf_mmsys(stddeb,"[mci extensions] entry %s for %s not supported.\n",str,t);
1211 return MCIERR_EXTENSION_NOT_FOUND;
1214 if (dwParam & MCI_OPEN_ALIAS) {
1215 dprintf_mmsys(stddeb, "MCI_OPEN // Alias='%s' !\n",
1216 (char*)PTR_SEG_TO_LIN(lpParms->lpstrAlias));
1217 GetOpenDrv(wDevID)->lpstrAlias = (LPSTR)SEGPTR_GET(
1218 SEGPTR_STRDUP((char*)PTR_SEG_TO_LIN(lpParms->lpstrAlias)));
1219 /* mplayer does allocate alias to CDAUDIO */
1221 if (dwParam & MCI_OPEN_TYPE) {
1222 if (dwParam & MCI_OPEN_TYPE_ID) {
1223 dprintf_mmsys(stddeb, "MCI_OPEN // Dev=%08lx!\n", (DWORD)lpParms->lpstrDeviceType);
1224 uDevTyp = LOWORD((DWORD)lpParms->lpstrDeviceType);
1225 GetOpenDrv(wDevID)->lpstrDeviceType=(LPSTR)lpParms->lpstrDeviceType;
1227 if (lpParms->lpstrDeviceType == NULL) return MCIERR_INTERNAL;
1228 dprintf_mmsys(stddeb, "MCI_OPEN // Dev='%s' !\n",
1229 (char*)PTR_SEG_TO_LIN(lpParms->lpstrDeviceType));
1230 GetOpenDrv(wDevID)->lpstrDeviceType=(LPSTR)SEGPTR_GET(
1231 SEGPTR_STRDUP((char*)PTR_SEG_TO_LIN(lpParms->lpstrDeviceType)));
1232 strcpy(str, PTR_SEG_TO_LIN(lpParms->lpstrDeviceType));
1234 if (strcmp(str, "CDAUDIO") == 0) {
1235 uDevTyp = MCI_DEVTYPE_CD_AUDIO;
1237 if (strcmp(str, "WAVEAUDIO") == 0) {
1238 uDevTyp = MCI_DEVTYPE_WAVEFORM_AUDIO;
1240 if (strcmp(str, "SEQUENCER") == 0) {
1241 uDevTyp = MCI_DEVTYPE_SEQUENCER;
1243 if (strcmp(str, "ANIMATION1") == 0) {
1244 uDevTyp = MCI_DEVTYPE_ANIMATION;
1246 if (strcmp(str, "AVIVIDEO") == 0) {
1247 uDevTyp = MCI_DEVTYPE_DIGITAL_VIDEO;
1251 GetDrv(wDevID)->wType = uDevTyp;
1252 GetDrv(wDevID)->wDeviceID = 0; /* FIXME? for multiple devices */
1253 lpParms->wDeviceID = wDevID;
1254 dprintf_mmsys(stddeb, "MCI_OPEN // mcidev=%d, uDevTyp=%04X wDeviceID=%04X !\n",
1255 wDevID, uDevTyp, lpParms->wDeviceID);
1258 case MCI_DEVTYPE_CD_AUDIO:
1259 dwret = CDAUDIO_DriverProc( 0, 0, MCI_OPEN_DRIVER,
1260 dwParam, (DWORD)lp16Parms);
1262 case MCI_DEVTYPE_WAVEFORM_AUDIO:
1263 dwret = WAVE_DriverProc( 0, 0, MCI_OPEN_DRIVER,
1264 dwParam, (DWORD)lp16Parms);
1266 case MCI_DEVTYPE_SEQUENCER:
1267 dwret = MIDI_DriverProc( 0, 0, MCI_OPEN_DRIVER,
1268 dwParam, (DWORD)lp16Parms);
1270 case MCI_DEVTYPE_ANIMATION:
1271 dwret = ANIM_DriverProc( 0, 0, MCI_OPEN_DRIVER,
1272 dwParam, (DWORD)lp16Parms);
1274 case MCI_DEVTYPE_DIGITAL_VIDEO:
1275 dprintf_mmsys(stddeb, "MCI_OPEN // No DIGITAL_VIDEO yet !\n");
1276 return MCIERR_DEVICE_NOT_INSTALLED;
1278 dprintf_mmsys(stddeb, "MCI_OPEN // Invalid Device Name '%08lx' !\n", (DWORD)lpParms->lpstrDeviceType);
1279 return MCIERR_INVALID_DEVICE_NAME;
1283 if (dwParam&MCI_NOTIFY)
1284 mciDriverNotify(lpParms->dwCallback,wDevID,
1285 (dwret==0?MCI_NOTIFY_SUCCESSFUL:MCI_NOTIFY_FAILURE));
1287 /* only handled devices fall through */
1288 dprintf_mmsys(stddeb, "MCI_OPEN // wDevID = %04X wDeviceID = %d dwret = %ld\n",wDevID, lpParms->wDeviceID, dwret);
1293 /**************************************************************************
1294 * mciClose [internal]
1296 DWORD mciClose(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
1298 DWORD dwRet = MCIERR_INTERNAL;
1300 dprintf_mmsys(stddeb, "mciClose(%04x, %08lX, %p)\n", wDevID, dwParam, lpParms);
1301 switch(GetDrv(wDevID)->wType) {
1302 case MCI_DEVTYPE_CD_AUDIO:
1303 dwRet = CDAUDIO_DriverProc(GetDrv(wDevID)->wDeviceID,0,
1304 MCI_CLOSE, dwParam, (DWORD)lpParms);
1306 case MCI_DEVTYPE_WAVEFORM_AUDIO:
1307 dwRet = WAVE_DriverProc(GetDrv(wDevID)->wDeviceID, 0,
1311 case MCI_DEVTYPE_SEQUENCER:
1312 dwRet = MIDI_DriverProc(GetDrv(wDevID)->wDeviceID, 0,
1316 case MCI_DEVTYPE_ANIMATION:
1317 dwRet = ANIM_DriverProc(GetDrv(wDevID)->wDeviceID, 0,
1322 dprintf_mmsys(stddeb, "mciClose() // unknown device type=%04X !\n", GetDrv(wDevID)->wType);
1323 dwRet = MCIERR_DEVICE_NOT_INSTALLED;
1325 GetDrv(wDevID)->wType = 0;
1327 if (dwParam&MCI_NOTIFY)
1328 mciDriverNotify(lpParms->dwCallback,wDevID,
1329 (dwRet==0?MCI_NOTIFY_SUCCESSFUL:MCI_NOTIFY_FAILURE));
1331 dprintf_mmsys(stddeb, "mciClose() // returns %ld\n",dwRet);
1336 /**************************************************************************
1337 * mciSysinfo [internal]
1339 DWORD mciSysInfo(DWORD dwFlags, LPMCI_SYSINFO_PARMS16 lpParms)
1345 LPSTR SysFile = "SYSTEM.INI";
1346 dprintf_mci(stddeb, "mciSysInfo(%08lX, %08lX)\n", dwFlags, (DWORD)lpParms);
1347 lpstrReturn = PTR_SEG_TO_LIN(lpParms->lpstrReturn);
1349 case MCI_SYSINFO_QUANTITY:
1350 dprintf_mci(stddeb, "mciSysInfo // MCI_SYSINFO_QUANTITY \n");
1351 lpdwRet = (DWORD *)lpstrReturn;
1352 *(lpdwRet) = InstalledCount;
1354 case MCI_SYSINFO_INSTALLNAME:
1355 dprintf_mci(stddeb, "mciSysInfo // MCI_SYSINFO_INSTALLNAME \n");
1356 if (lpInstallNames == NULL) {
1358 InstalledListLen = 0;
1359 ptr = lpInstallNames = xmalloc(2048);
1360 GetPrivateProfileString32A("mci", NULL, "", lpInstallNames, 2000, SysFile);
1361 while(strlen(ptr) > 0) {
1362 dprintf_mci(stddeb, "---> '%s' \n", ptr);
1363 len = strlen(ptr) + 1;
1365 InstalledListLen += len;
1369 if (lpParms->dwRetSize < InstalledListLen)
1370 lstrcpyn32A(lpstrReturn, lpInstallNames, lpParms->dwRetSize - 1);
1372 strcpy(lpstrReturn, lpInstallNames);
1374 case MCI_SYSINFO_NAME:
1375 dprintf_mci(stddeb, "mciSysInfo // MCI_SYSINFO_NAME \n");
1377 case MCI_SYSINFO_OPEN:
1378 dprintf_mci(stddeb, "mciSysInfo // MCI_SYSINFO_OPEN \n");
1381 return MMSYSERR_INVALPARAM;
1384 /**************************************************************************
1385 * mciSound [internal]
1386 * not used anymore ??
1388 DWORD mciSound(UINT16 wDevID, DWORD dwParam, LPMCI_SOUND_PARMS lpParms)
1390 if (lpParms == NULL) return MCIERR_INTERNAL;
1391 if (dwParam & MCI_SOUND_NAME)
1392 dprintf_mci(stddeb, "MCI_SOUND // file='%s' !\n", lpParms->lpstrSoundName);
1393 return MCIERR_INVALID_DEVICE_ID;
1398 static const char *_mciCommandToString(UINT16 wMsg)
1400 static char buffer[100];
1402 #define CASE(s) case (s): return #s
1413 CASE(MCI_GETDEVCAPS);
1437 sprintf(buffer, "%04X", wMsg);
1443 /**************************************************************************
1444 * mciSendCommand [MMSYSTEM.701]
1446 DWORD WINAPI mciSendCommand(UINT16 wDevID, UINT16 wMsg, DWORD dwParam1,
1450 dprintf_mci(stddeb, "mciSendCommand(%04X, %s, %08lX, %08lX)\n",
1451 wDevID, _mciCommandToString(wMsg), dwParam1, dwParam2);
1455 return mciOpen(dwParam1, (LPMCI_OPEN_PARMS16)dwParam2);
1457 return mciClose( wDevID, dwParam1,
1458 (LPMCI_GENERIC_PARMS)PTR_SEG_TO_LIN(dwParam2));
1460 return mciSysInfo( dwParam1,
1461 (LPMCI_SYSINFO_PARMS16)PTR_SEG_TO_LIN(dwParam2));
1463 switch(GetDrv(wDevID)->wType)
1465 case MCI_DEVTYPE_CD_AUDIO:
1466 return CDAUDIO_DriverProc(GetDrv(wDevID)->wDeviceID, hDrv,
1467 wMsg, dwParam1, dwParam2);
1468 case MCI_DEVTYPE_WAVEFORM_AUDIO:
1469 return WAVE_DriverProc(GetDrv(wDevID)->wDeviceID, hDrv,
1470 wMsg, dwParam1, dwParam2);
1471 case MCI_DEVTYPE_SEQUENCER:
1472 return MIDI_DriverProc(GetDrv(wDevID)->wDeviceID, hDrv,
1473 wMsg, dwParam1, dwParam2);
1474 case MCI_DEVTYPE_ANIMATION:
1475 return ANIM_DriverProc(GetDrv(wDevID)->wDeviceID, hDrv,
1476 wMsg, dwParam1, dwParam2);
1479 "mciSendCommand() // unknown device type=%04X !\n",
1480 GetDrv(wDevID)->wType);
1483 return MMSYSERR_INVALPARAM;
1486 /**************************************************************************
1487 * mciGetDeviceID [MMSYSTEM.703]
1489 UINT16 WINAPI mciGetDeviceID (LPCSTR lpstrName)
1493 dprintf_mci(stddeb, "mciGetDeviceID(\"%s\")\n", lpstrName);
1494 if (lpstrName && !lstrcmpi32A(lpstrName, "ALL"))
1495 return MCI_ALL_DEVICE_ID;
1500 wDevID = MMSYSTEM_FirstDevID();
1501 while(MMSYSTEM_DevIDValid(wDevID) && GetDrv(wDevID)->wType) {
1502 if (GetOpenDrv(wDevID)->lpstrDeviceType &&
1503 strcmp(PTR_SEG_TO_LIN(GetOpenDrv(wDevID)->lpstrDeviceType), lpstrName) == 0)
1506 if (GetOpenDrv(wDevID)->lpstrAlias &&
1507 strcmp(PTR_SEG_TO_LIN(GetOpenDrv(wDevID)->lpstrAlias), lpstrName) == 0)
1510 wDevID = MMSYSTEM_NextDevID(wDevID);
1516 /**************************************************************************
1517 * mciSetYieldProc [MMSYSTEM.714]
1519 BOOL16 WINAPI mciSetYieldProc (UINT16 uDeviceID,
1520 YIELDPROC fpYieldProc, DWORD dwYieldData)
1525 /**************************************************************************
1526 * mciGetDeviceIDFromElementID [MMSYSTEM.715]
1528 UINT16 WINAPI mciGetDeviceIDFromElementID(DWORD dwElementID, LPCSTR lpstrType)
1533 /**************************************************************************
1534 * mciGetYieldProc [MMSYSTEM.716]
1536 YIELDPROC WINAPI mciGetYieldProc(UINT16 uDeviceID, DWORD * lpdwYieldData)
1541 /**************************************************************************
1542 * mciGetCreatorTask [MMSYSTEM.717]
1544 HTASK16 WINAPI mciGetCreatorTask(UINT16 uDeviceID)
1549 /**************************************************************************
1550 * midiOutGetNumDevs [WINMM.80]
1552 UINT32 WINAPI midiOutGetNumDevs32(void)
1554 return midiOutGetNumDevs16();
1556 /**************************************************************************
1557 * midiOutGetNumDevs [MMSYSTEM.201]
1559 UINT16 WINAPI midiOutGetNumDevs16(void)
1562 dprintf_mmsys(stddeb, "midiOutGetNumDevs\n");
1563 count += modMessage(0, MODM_GETNUMDEVS, 0L, 0L, 0L);
1564 dprintf_mmsys(stddeb, "midiOutGetNumDevs return %u \n", count);
1568 /**************************************************************************
1569 * midiOutGetDevCapsW [WINMM.76]
1571 UINT32 WINAPI midiOutGetDevCaps32W(UINT32 uDeviceID,LPMIDIOUTCAPS32W lpCaps, UINT32 uSize)
1573 MIDIOUTCAPS16 moc16;
1576 ret = midiOutGetDevCaps16(uDeviceID,&moc16,sizeof(moc16));
1577 lpCaps->wMid = moc16.wMid;
1578 lpCaps->wPid = moc16.wPid;
1579 lpCaps->vDriverVersion = moc16.vDriverVersion;
1580 lstrcpyAtoW(lpCaps->szPname,moc16.szPname);
1581 lpCaps->wTechnology = moc16.wTechnology;
1582 lpCaps->wVoices = moc16.wVoices;
1583 lpCaps->wNotes = moc16.wNotes;
1584 lpCaps->wChannelMask = moc16.wChannelMask;
1585 lpCaps->dwSupport = moc16.dwSupport;
1588 /**************************************************************************
1589 * midiOutGetDevCapsA [WINMM.75]
1591 UINT32 WINAPI midiOutGetDevCaps32A(UINT32 uDeviceID,LPMIDIOUTCAPS32A lpCaps, UINT32 uSize)
1593 MIDIOUTCAPS16 moc16;
1596 ret = midiOutGetDevCaps16(uDeviceID,&moc16,sizeof(moc16));
1597 lpCaps->wMid = moc16.wMid;
1598 lpCaps->wPid = moc16.wPid;
1599 lpCaps->vDriverVersion = moc16.vDriverVersion;
1600 strcpy(lpCaps->szPname,moc16.szPname);
1601 lpCaps->wTechnology = moc16.wTechnology;
1602 lpCaps->wVoices = moc16.wVoices;
1603 lpCaps->wNotes = moc16.wNotes;
1604 lpCaps->wChannelMask = moc16.wChannelMask;
1605 lpCaps->dwSupport = moc16.dwSupport;
1609 /**************************************************************************
1610 * midiOutGetDevCaps [MMSYSTEM.202]
1612 UINT16 WINAPI midiOutGetDevCaps16(UINT16 uDeviceID,LPMIDIOUTCAPS16 lpCaps, UINT16 uSize)
1614 dprintf_mmsys(stddeb, "midiOutGetDevCaps\n");
1615 return modMessage(uDeviceID,MODM_GETDEVCAPS,0,(DWORD)lpCaps,uSize);
1618 /**************************************************************************
1619 * midiOutGetErrorTextA [WINMM.77]
1621 UINT32 WINAPI midiOutGetErrorText32A(UINT32 uError, LPSTR lpText, UINT32 uSize)
1623 dprintf_mmsys(stddeb, "midiOutGetErrorText\n");
1624 return midiGetErrorText(uError, lpText, uSize);
1627 /**************************************************************************
1628 * midiOutGetErrorTextW [WINMM.78]
1630 UINT32 WINAPI midiOutGetErrorText32W(UINT32 uError, LPWSTR lpText, UINT32 uSize)
1632 LPSTR xstr = HeapAlloc(GetProcessHeap(),0,uSize);
1634 dprintf_mmsys(stddeb, "midiOutGetErrorText\n");
1635 ret = midiGetErrorText(uError, xstr, uSize);
1636 lstrcpyAtoW(lpText,xstr);
1637 HeapFree(GetProcessHeap(),0,xstr);
1640 /**************************************************************************
1641 * midiOutGetErrorText [MMSYSTEM.203]
1643 UINT16 WINAPI midiOutGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
1645 dprintf_mmsys(stddeb, "midiOutGetErrorText\n");
1646 return midiGetErrorText(uError, lpText, uSize);
1649 /**************************************************************************
1650 * midiGetErrorText [internal]
1652 UINT16 WINAPI midiGetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize)
1655 if ((lpText == NULL) || (uSize < 1)) return(FALSE);
1658 case MIDIERR_UNPREPARED:
1659 msgptr = "The MIDI header was not prepared. Use the Prepare function to prepare the header, and then try again.";
1661 case MIDIERR_STILLPLAYING:
1662 msgptr = "Cannot perform this operation while media data is still playing. Reset the device, or wait until the data is finished playing.";
1665 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.";
1667 case MIDIERR_NOTREADY:
1668 msgptr = "The port is transmitting data to the device. Wait until the data has been transmitted, and then try again.";
1670 case MIDIERR_NODEVICE:
1671 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.";
1673 case MIDIERR_INVALIDSETUP:
1674 msgptr = "The current MIDI setup is damaged. Copy the original MIDIMAP.CFG file to the Windows SYSTEM directory, and then try again.";
1677 msg# 336 : Cannot use the song-pointer time format and the SMPTE time-format together.
1678 msg# 337 : The specified MIDI device is already in use. Wait until it is free, and then try again.
1679 msg# 338 : The specified MIDI device is not installed on the system. Use the Drivers option in Control Panel to install the driver.
1680 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.
1681 msg# 340 : An error occurred using the specified port.
1682 msg# 341 : All multimedia timers are being used by other applications. Quit one of these applications, and then try again.
1683 msg# 342 : There is no current MIDI port.
1684 msg# 343 : There are no MIDI devices installed on the system. Use the Drivers option in Control Panel to install the driver.
1687 msgptr = "Unknown MIDI Error !\n";
1690 lstrcpyn32A(lpText, msgptr, uSize);
1694 /**************************************************************************
1695 * midiOutOpen [WINM.84]
1697 UINT32 WINAPI midiOutOpen32(HMIDIOUT32 * lphMidiOut, UINT32 uDeviceID,
1698 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
1703 ret = midiOutOpen16(&hmo16,uDeviceID,dwCallback,dwInstance,dwFlags);
1704 if (lphMidiOut) *lphMidiOut = hmo16;
1707 /**************************************************************************
1708 * midiOutOpen [MMSYSTEM.204]
1710 UINT16 WINAPI midiOutOpen16(HMIDIOUT16 * lphMidiOut, UINT16 uDeviceID,
1711 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
1714 LPMIDIOPENDESC lpDesc;
1716 BOOL32 bMapperFlg = FALSE;
1717 if (lphMidiOut != NULL) *lphMidiOut = 0;
1718 dprintf_mmsys(stddeb, "midiOutOpen(%p, %d, %08lX, %08lX, %08lX);\n",
1719 lphMidiOut, uDeviceID, dwCallback, dwInstance, dwFlags);
1720 if (uDeviceID == (UINT16)MIDI_MAPPER) {
1721 dprintf_mmsys(stddeb, "midiOutOpen // MIDI_MAPPER mode requested !\n");
1725 hMidiOut = USER_HEAP_ALLOC(sizeof(MIDIOPENDESC));
1726 if (lphMidiOut != NULL) *lphMidiOut = hMidiOut;
1727 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1729 return MMSYSERR_NOMEM;
1730 lpDesc->hMidi = hMidiOut;
1731 lpDesc->dwCallback = dwCallback;
1732 lpDesc->dwInstance = dwInstance;
1733 while(uDeviceID < MAXMIDIDRIVERS) {
1734 dwRet = modMessage(uDeviceID, MODM_OPEN,
1735 lpDesc->dwInstance, (DWORD)lpDesc, 0L);
1736 if (dwRet == MMSYSERR_NOERROR) break;
1737 if (!bMapperFlg) break;
1739 dprintf_mmsys(stddeb, "midiOutOpen // MIDI_MAPPER mode ! try next driver...\n");
1744 /**************************************************************************
1745 * midiOutClose [WINMM.74]
1747 UINT32 WINAPI midiOutClose32(HMIDIOUT32 hMidiOut)
1749 return midiOutClose16(hMidiOut);
1752 /**************************************************************************
1753 * midiOutClose [MMSYSTEM.205]
1755 UINT16 WINAPI midiOutClose16(HMIDIOUT16 hMidiOut)
1757 LPMIDIOPENDESC lpDesc;
1758 dprintf_mmsys(stddeb, "midiOutClose(%04X)\n", hMidiOut);
1759 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1760 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1761 return modMessage(0, MODM_CLOSE, lpDesc->dwInstance, 0L, 0L);
1764 /**************************************************************************
1765 * midiOutPrepareHeader [WINMM.85]
1767 UINT32 WINAPI midiOutPrepareHeader32(HMIDIOUT32 hMidiOut,
1768 MIDIHDR * lpMidiOutHdr, UINT32 uSize)
1770 return midiOutPrepareHeader16(hMidiOut,lpMidiOutHdr,uSize);
1773 /**************************************************************************
1774 * midiOutPrepareHeader [MMSYSTEM.206]
1776 UINT16 WINAPI midiOutPrepareHeader16(HMIDIOUT16 hMidiOut,
1777 MIDIHDR * lpMidiOutHdr, UINT16 uSize)
1779 LPMIDIOPENDESC lpDesc;
1780 dprintf_mmsys(stddeb, "midiOutPrepareHeader(%04X, %p, %d)\n",
1781 hMidiOut, lpMidiOutHdr, uSize);
1782 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1783 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1784 return modMessage(0, MODM_PREPARE, lpDesc->dwInstance,
1785 (DWORD)lpMidiOutHdr, (DWORD)uSize);
1788 /**************************************************************************
1789 * midiOutUnprepareHeader [WINMM.89]
1791 UINT32 WINAPI midiOutUnprepareHeader32(HMIDIOUT32 hMidiOut,
1792 MIDIHDR * lpMidiOutHdr, UINT32 uSize)
1794 return midiOutUnprepareHeader16(hMidiOut,lpMidiOutHdr,uSize);
1796 /**************************************************************************
1797 * midiOutUnprepareHeader [MMSYSTEM.207]
1799 UINT16 WINAPI midiOutUnprepareHeader16(HMIDIOUT16 hMidiOut,
1800 MIDIHDR * lpMidiOutHdr, UINT16 uSize)
1802 LPMIDIOPENDESC lpDesc;
1803 dprintf_mmsys(stddeb, "midiOutUnprepareHeader(%04X, %p, %d)\n",
1804 hMidiOut, lpMidiOutHdr, uSize);
1805 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1806 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1807 return modMessage(0, MODM_UNPREPARE, lpDesc->dwInstance,
1808 (DWORD)lpMidiOutHdr, (DWORD)uSize);
1811 /**************************************************************************
1812 * midiOutShortMsg [WINMM.88]
1814 UINT32 WINAPI midiOutShortMsg32(HMIDIOUT32 hMidiOut, DWORD dwMsg)
1816 return midiOutShortMsg16(hMidiOut,dwMsg);
1818 /**************************************************************************
1819 * midiOutShortMsg [MMSYSTEM.208]
1821 UINT16 WINAPI midiOutShortMsg16(HMIDIOUT16 hMidiOut, DWORD dwMsg)
1823 LPMIDIOPENDESC lpDesc;
1824 dprintf_mmsys(stddeb, "midiOutShortMsg(%04X, %08lX)\n", hMidiOut, dwMsg);
1825 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1826 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1827 return modMessage(0, MODM_DATA, lpDesc->dwInstance, dwMsg, 0L);
1830 /**************************************************************************
1831 * midiOutLongMsg [WINMM.82]
1833 UINT32 WINAPI midiOutLongMsg32(HMIDIOUT32 hMidiOut,
1834 MIDIHDR * lpMidiOutHdr, UINT32 uSize)
1836 return midiOutLongMsg16(hMidiOut,lpMidiOutHdr,uSize);
1839 /**************************************************************************
1840 * midiOutLongMsg [MMSYSTEM.209]
1842 UINT16 WINAPI midiOutLongMsg16(HMIDIOUT16 hMidiOut,
1843 MIDIHDR * lpMidiOutHdr, UINT16 uSize)
1845 LPMIDIOPENDESC lpDesc;
1846 dprintf_mmsys(stddeb, "midiOutLongMsg(%04X, %p, %d)\n",
1847 hMidiOut, lpMidiOutHdr, uSize);
1848 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1849 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1850 return modMessage(0, MODM_LONGDATA, lpDesc->dwInstance,
1851 (DWORD)lpMidiOutHdr, (DWORD)uSize);
1854 /**************************************************************************
1855 * midiOutReset [WINMM.86]
1857 UINT32 WINAPI midiOutReset32(HMIDIOUT32 hMidiOut)
1859 return midiOutReset16(hMidiOut);
1862 /**************************************************************************
1863 * midiOutReset [MMSYSTEM.210]
1865 UINT16 WINAPI midiOutReset16(HMIDIOUT16 hMidiOut)
1867 LPMIDIOPENDESC lpDesc;
1868 dprintf_mmsys(stddeb, "midiOutReset(%04X)\n", hMidiOut);
1869 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1870 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1871 return modMessage(0, MODM_RESET, lpDesc->dwInstance, 0L, 0L);
1874 /**************************************************************************
1875 * midiOutGetVolume [WINM.81]
1877 UINT32 WINAPI midiOutGetVolume32(UINT32 uDeviceID, DWORD * lpdwVolume)
1879 return midiOutGetVolume16(uDeviceID,lpdwVolume);
1881 /**************************************************************************
1882 * midiOutGetVolume [MMSYSTEM.211]
1884 UINT16 WINAPI midiOutGetVolume16(UINT16 uDeviceID, DWORD * lpdwVolume)
1886 dprintf_mmsys(stddeb, "midiOutGetVolume(%04X, %p);\n", uDeviceID, lpdwVolume);
1887 return modMessage(uDeviceID, MODM_GETVOLUME, 0L, (DWORD)lpdwVolume, 0L);
1890 /**************************************************************************
1891 * midiOutSetVolume [WINMM.87]
1893 UINT32 WINAPI midiOutSetVolume32(UINT32 uDeviceID, DWORD dwVolume)
1895 return midiOutSetVolume16(uDeviceID,dwVolume);
1898 /**************************************************************************
1899 * midiOutSetVolume [MMSYSTEM.212]
1901 UINT16 WINAPI midiOutSetVolume16(UINT16 uDeviceID, DWORD dwVolume)
1903 dprintf_mmsys(stddeb, "midiOutSetVolume(%04X, %08lX);\n", uDeviceID, dwVolume);
1904 return modMessage(uDeviceID, MODM_SETVOLUME, 0L, dwVolume, 0L);
1907 /**************************************************************************
1908 * midiOutCachePatches [WINMM.73]
1910 UINT32 WINAPI midiOutCachePatches32(HMIDIOUT32 hMidiOut, UINT32 uBank,
1911 WORD * lpwPatchArray, UINT32 uFlags)
1913 return midiOutCachePatches16(hMidiOut,uBank,lpwPatchArray,uFlags);
1916 /**************************************************************************
1917 * midiOutCachePatches [MMSYSTEM.213]
1919 UINT16 WINAPI midiOutCachePatches16(HMIDIOUT16 hMidiOut, UINT16 uBank,
1920 WORD * lpwPatchArray, UINT16 uFlags)
1922 /* not really necessary to support this */
1923 fprintf(stdnimp, "midiOutCachePatches: not supported yet\n");
1924 return MMSYSERR_NOTSUPPORTED;
1927 /**************************************************************************
1928 * midiOutCacheDrumPatches [WINMM.72]
1930 UINT32 WINAPI midiOutCacheDrumPatches32(HMIDIOUT32 hMidiOut, UINT32 uPatch,
1931 WORD * lpwKeyArray, UINT32 uFlags)
1933 return midiOutCacheDrumPatches16(hMidiOut,uPatch,lpwKeyArray,uFlags);
1936 /**************************************************************************
1937 * midiOutCacheDrumPatches [MMSYSTEM.214]
1939 UINT16 WINAPI midiOutCacheDrumPatches16(HMIDIOUT16 hMidiOut, UINT16 uPatch,
1940 WORD * lpwKeyArray, UINT16 uFlags)
1942 fprintf(stdnimp, "midiOutCacheDrumPatchesi: not supported yet\n");
1943 return MMSYSERR_NOTSUPPORTED;
1946 /**************************************************************************
1947 * midiOutGetID [WINMM.79]
1949 UINT32 WINAPI midiOutGetID32(HMIDIOUT32 hMidiOut, UINT32 * lpuDeviceID)
1954 ret = midiOutGetID16(hMidiOut,&xid);
1959 /**************************************************************************
1960 * midiOutGetID [MMSYSTEM.215]
1962 UINT16 WINAPI midiOutGetID16(HMIDIOUT16 hMidiOut, UINT16 * lpuDeviceID)
1964 dprintf_mmsys(stddeb, "midiOutGetID\n");
1968 /**************************************************************************
1969 * midiOutMessage [WINMM.83]
1971 DWORD WINAPI midiOutMessage32(HMIDIOUT32 hMidiOut, UINT32 uMessage,
1972 DWORD dwParam1, DWORD dwParam2)
1974 LPMIDIOPENDESC lpDesc;
1976 dprintf_mmsys(stddeb, "midiOutMessage(%04X, %04X, %08lX, %08lX)\n",
1977 hMidiOut, uMessage, dwParam1, dwParam2);
1978 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1979 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1982 fprintf(stderr,"midiOutMessage32: can't handle MODM_OPEN!\n");
1984 case MODM_GETDEVCAPS:
1985 return midiOutGetDevCaps32A(hMidiOut,(LPMIDIOUTCAPS32A)dwParam1,dwParam2);
1986 case MODM_GETNUMDEVS:
1989 case MODM_GETVOLUME:
1990 case MODM_SETVOLUME:
1993 case MODM_UNPREPARE:
1994 /* no argument conversion needed */
1997 fprintf(stderr,"unhandled midiOutMessage32(%04x,%04x,%08lx,%08lx)\n",
1998 hMidiOut,uMessage,dwParam1,dwParam2
2002 return modMessage(0, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
2005 /**************************************************************************
2006 * midiOutMessage [MMSYSTEM.216]
2008 DWORD WINAPI midiOutMessage16(HMIDIOUT16 hMidiOut, UINT16 uMessage,
2009 DWORD dwParam1, DWORD dwParam2)
2011 LPMIDIOPENDESC lpDesc;
2013 dprintf_mmsys(stddeb, "midiOutMessage(%04X, %04X, %08lX, %08lX)\n",
2014 hMidiOut, uMessage, dwParam1, dwParam2);
2015 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
2016 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2019 fprintf(stderr,"midiOutMessage16: can't handle MODM_OPEN!\n");
2021 case MODM_GETNUMDEVS:
2024 case MODM_SETVOLUME:
2025 /* no argument conversion needed */
2027 case MODM_GETVOLUME:
2028 return midiOutGetVolume16(hMidiOut,(LPDWORD)PTR_SEG_TO_LIN(dwParam1));
2030 return midiOutLongMsg16(hMidiOut,(LPMIDIHDR)PTR_SEG_TO_LIN(dwParam1),dwParam2);
2032 return midiOutPrepareHeader16(hMidiOut,(LPMIDIHDR)PTR_SEG_TO_LIN(dwParam1),dwParam2);
2033 case MODM_UNPREPARE:
2034 return midiOutUnprepareHeader16(hMidiOut,(LPMIDIHDR)PTR_SEG_TO_LIN(dwParam1),dwParam2);
2036 fprintf(stderr,"unhandled midiOutMessage16(%04x,%04x,%08lx,%08lx)\n",
2037 hMidiOut,uMessage,dwParam1,dwParam2
2041 return modMessage(0, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
2044 /**************************************************************************
2045 * midiInGetNumDevs [WINMM.64]
2047 UINT32 WINAPI midiInGetNumDevs32(void)
2049 return midiInGetNumDevs16();
2052 /**************************************************************************
2053 * midiInGetNumDevs [MMSYSTEM.301]
2055 UINT16 WINAPI midiInGetNumDevs16(void)
2058 dprintf_mmsys(stddeb, "midiInGetNumDevs\n");
2059 count += midMessage(0, MIDM_GETNUMDEVS, 0L, 0L, 0L);
2060 dprintf_mmsys(stddeb, "midiInGetNumDevs return %u \n", count);
2064 /**************************************************************************
2065 * midiInGetDevCaps [WINMM.60]
2067 UINT32 WINAPI midiInGetDevCaps32W(UINT32 uDeviceID,
2068 LPMIDIINCAPS32W lpCaps, UINT32 uSize)
2071 UINT32 ret = midiInGetDevCaps16(uDeviceID,&mic16,uSize);
2073 lpCaps->wMid = mic16.wMid;
2074 lpCaps->wPid = mic16.wPid;
2075 lpCaps->vDriverVersion = mic16.vDriverVersion;
2076 lstrcpyAtoW(lpCaps->szPname,mic16.szPname);
2077 lpCaps->dwSupport = mic16.dwSupport;
2081 /**************************************************************************
2082 * midiInGetDevCaps [WINMM.59]
2084 UINT32 WINAPI midiInGetDevCaps32A(UINT32 uDeviceID,
2085 LPMIDIINCAPS32A lpCaps, UINT32 uSize)
2088 UINT32 ret = midiInGetDevCaps16(uDeviceID,&mic16,uSize);
2090 lpCaps->wMid = mic16.wMid;
2091 lpCaps->wPid = mic16.wPid;
2092 lpCaps->vDriverVersion = mic16.vDriverVersion;
2093 strcpy(lpCaps->szPname,mic16.szPname);
2094 lpCaps->dwSupport = mic16.dwSupport;
2098 /**************************************************************************
2099 * midiInGetDevCaps [MMSYSTEM.302]
2101 UINT16 WINAPI midiInGetDevCaps16(UINT16 uDeviceID,
2102 LPMIDIINCAPS16 lpCaps, UINT16 uSize)
2104 dprintf_mmsys(stddeb, "midiInGetDevCaps\n");
2105 return midMessage(uDeviceID,MIDM_GETDEVCAPS,0,(DWORD)lpCaps,uSize);;
2108 /**************************************************************************
2109 * midiInGetErrorText [WINMM.62]
2111 UINT32 WINAPI midiInGetErrorText32W(UINT32 uError, LPWSTR lpText, UINT32 uSize)
2113 LPSTR xstr = HeapAlloc(GetProcessHeap(),0,uSize);
2114 UINT32 ret = midiInGetErrorText16(uError,xstr,uSize);
2115 lstrcpyAtoW(lpText,xstr);
2116 HeapFree(GetProcessHeap(),0,xstr);
2119 /**************************************************************************
2120 * midiInGetErrorText [WINMM.61]
2122 UINT32 WINAPI midiInGetErrorText32A(UINT32 uError, LPSTR lpText, UINT32 uSize)
2124 return midiInGetErrorText16(uError,lpText,uSize);
2127 /**************************************************************************
2128 * midiInGetErrorText [MMSYSTEM.303]
2130 UINT16 WINAPI midiInGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
2132 dprintf_mmsys(stddeb, "midiInGetErrorText\n");
2133 return (midiGetErrorText(uError, lpText, uSize));
2136 /**************************************************************************
2137 * midiInOpen [WINMM.66]
2139 UINT32 WINAPI midiInOpen32(HMIDIIN32 * lphMidiIn, UINT32 uDeviceID,
2140 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
2143 UINT32 ret = midiInOpen16(&xhmid16,uDeviceID,dwCallback,dwInstance,dwFlags);
2144 if (lphMidiIn) *lphMidiIn = xhmid16;
2148 /**************************************************************************
2149 * midiInOpen [MMSYSTEM.304]
2151 UINT16 WINAPI midiInOpen16(HMIDIIN16 * lphMidiIn, UINT16 uDeviceID,
2152 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
2155 LPMIDIOPENDESC lpDesc;
2157 BOOL32 bMapperFlg = FALSE;
2159 if (lphMidiIn != NULL) *lphMidiIn = 0;
2160 dprintf_mmsys(stddeb, "midiInOpen(%p, %d, %08lX, %08lX, %08lX);\n",
2161 lphMidiIn, uDeviceID, dwCallback, dwInstance, dwFlags);
2162 if (uDeviceID == (UINT16)MIDI_MAPPER) {
2163 dprintf_mmsys(stddeb, "midiInOpen // MIDI_MAPPER mode requested !\n");
2167 hMidiIn = USER_HEAP_ALLOC(sizeof(MIDIOPENDESC));
2168 if (lphMidiIn != NULL) *lphMidiIn = hMidiIn;
2169 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2170 if (lpDesc == NULL) return MMSYSERR_NOMEM;
2171 lpDesc->hMidi = hMidiIn;
2172 lpDesc->dwCallback = dwCallback;
2173 lpDesc->dwInstance = dwInstance;
2174 while(uDeviceID < MAXMIDIDRIVERS) {
2175 dwRet = midMessage(uDeviceID, MIDM_OPEN,
2176 lpDesc->dwInstance, (DWORD)lpDesc, 0L);
2177 if (dwRet == MMSYSERR_NOERROR) break;
2178 if (!bMapperFlg) break;
2180 dprintf_mmsys(stddeb, "midiInOpen // MIDI_MAPPER mode ! try next driver...\n");
2185 /**************************************************************************
2186 * midiInClose [WINMM.58]
2188 UINT32 WINAPI midiInClose32(HMIDIIN32 hMidiIn)
2190 return midiInClose16(hMidiIn);
2193 /**************************************************************************
2194 * midiInClose [MMSYSTEM.305]
2196 UINT16 WINAPI midiInClose16(HMIDIIN16 hMidiIn)
2198 LPMIDIOPENDESC lpDesc;
2199 dprintf_mmsys(stddeb, "midiInClose(%04X)\n", hMidiIn);
2200 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2201 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2202 return midMessage(0, MIDM_CLOSE, lpDesc->dwInstance, 0L, 0L);
2205 /**************************************************************************
2206 * midiInPrepareHeader [WINMM.67]
2208 UINT32 WINAPI midiInPrepareHeader32(HMIDIIN32 hMidiIn,
2209 MIDIHDR * lpMidiInHdr, UINT32 uSize)
2211 return midiInPrepareHeader16(hMidiIn,lpMidiInHdr,uSize);
2214 /**************************************************************************
2215 * midiInPrepareHeader [MMSYSTEM.306]
2217 UINT16 WINAPI midiInPrepareHeader16(HMIDIIN16 hMidiIn,
2218 MIDIHDR * lpMidiInHdr, UINT16 uSize)
2220 LPMIDIOPENDESC lpDesc;
2221 dprintf_mmsys(stddeb, "midiInPrepareHeader(%04X, %p, %d)\n",
2222 hMidiIn, lpMidiInHdr, uSize);
2223 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2224 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2225 return midMessage(0, MIDM_PREPARE, lpDesc->dwInstance,
2226 (DWORD)lpMidiInHdr, (DWORD)uSize);
2229 /**************************************************************************
2230 * midiInUnprepareHeader [WINMM.71]
2232 UINT32 WINAPI midiInUnprepareHeader32(HMIDIIN32 hMidiIn,
2233 MIDIHDR * lpMidiInHdr, UINT32 uSize)
2235 return midiInUnprepareHeader16(hMidiIn,lpMidiInHdr,uSize);
2238 /**************************************************************************
2239 * midiInUnprepareHeader [MMSYSTEM.307]
2241 UINT16 WINAPI midiInUnprepareHeader16(HMIDIIN16 hMidiIn,
2242 MIDIHDR * lpMidiInHdr, UINT16 uSize)
2244 LPMIDIOPENDESC lpDesc;
2245 dprintf_mmsys(stddeb, "midiInUnprepareHeader(%04X, %p, %d)\n",
2246 hMidiIn, lpMidiInHdr, uSize);
2247 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2248 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2249 return midMessage(0, MIDM_UNPREPARE, lpDesc->dwInstance,
2250 (DWORD)lpMidiInHdr, (DWORD)uSize);
2253 /**************************************************************************
2254 * midiInAddBuffer [WINMM.57]
2256 UINT32 WINAPI midiInAddBuffer32(HMIDIIN32 hMidiIn,
2257 MIDIHDR * lpMidiInHdr, UINT32 uSize)
2259 return midiInAddBuffer16(hMidiIn,lpMidiInHdr,uSize);
2262 /**************************************************************************
2263 * midiInAddBuffer [MMSYSTEM.308]
2265 UINT16 WINAPI midiInAddBuffer16(HMIDIIN16 hMidiIn,
2266 MIDIHDR * lpMidiInHdr, UINT16 uSize)
2268 dprintf_mmsys(stddeb, "midiInAddBuffer\n");
2272 /**************************************************************************
2273 * midiInStart [WINMM.69]
2275 UINT32 WINAPI midiInStart32(HMIDIIN32 hMidiIn)
2277 return midiInStart16(hMidiIn);
2280 /**************************************************************************
2281 * midiInStart [MMSYSTEM.309]
2283 UINT16 WINAPI midiInStart16(HMIDIIN16 hMidiIn)
2285 dprintf_mmsys(stddeb, "midiInStart\n");
2289 /**************************************************************************
2290 * midiInStop [WINMM.70]
2292 UINT32 WINAPI midiInStop32(HMIDIIN32 hMidiIn)
2294 return midiInStop16(hMidiIn);
2297 /**************************************************************************
2298 * midiInStop [MMSYSTEM.310]
2300 UINT16 WINAPI midiInStop16(HMIDIIN16 hMidiIn)
2302 dprintf_mmsys(stddeb, "midiInStop\n");
2306 /**************************************************************************
2307 * midiInReset [WINMM.68]
2309 UINT32 WINAPI midiInReset32(HMIDIIN32 hMidiIn)
2311 return midiInReset16(hMidiIn);
2314 /**************************************************************************
2315 * midiInReset [MMSYSTEM.311]
2317 UINT16 WINAPI midiInReset16(HMIDIIN16 hMidiIn)
2319 dprintf_mmsys(stddeb, "midiInReset\n");
2323 /**************************************************************************
2324 * midiInGetID [WINMM.63]
2326 UINT32 WINAPI midiInGetID32(HMIDIIN32 hMidiIn, UINT32 * lpuDeviceID)
2328 dprintf_mmsys(stddeb, "midiInGetID\n");
2332 /**************************************************************************
2333 * midiInGetID [MMSYSTEM.312]
2335 UINT16 WINAPI midiInGetID16(HMIDIIN16 hMidiIn, UINT16 * lpuDeviceID)
2337 dprintf_mmsys(stddeb, "midiInGetID\n");
2341 /**************************************************************************
2342 * midiInMessage [WINMM.65]
2344 DWORD WINAPI midiInMessage32(HMIDIIN32 hMidiIn, UINT32 uMessage,
2345 DWORD dwParam1, DWORD dwParam2)
2347 LPMIDIOPENDESC lpDesc;
2348 dprintf_mmsys(stddeb, "midiInMessage(%04X, %04X, %08lX, %08lX)\n",
2349 hMidiIn, uMessage, dwParam1, dwParam2);
2350 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2351 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2354 fprintf(stderr,"midiInMessage32: can't handle MIDM_OPEN!\n");
2356 case MIDM_GETDEVCAPS:
2357 return midiInGetDevCaps32A(hMidiIn,(LPMIDIINCAPS32A)dwParam1,dwParam2);
2358 case MIDM_GETNUMDEVS:
2363 /* no argument conversion needed */
2366 return midiInPrepareHeader32(hMidiIn,(LPMIDIHDR)dwParam1,dwParam2);
2367 case MIDM_UNPREPARE:
2368 return midiInUnprepareHeader32(hMidiIn,(LPMIDIHDR)dwParam1,dwParam2);
2369 case MIDM_ADDBUFFER:
2370 return midiInAddBuffer32(hMidiIn,(LPMIDIHDR)dwParam1,dwParam2);
2372 fprintf(stderr,"unhandled midiInMessage32(%04x,%04x,%08lx,%08lx)\n",
2373 hMidiIn,uMessage,dwParam1,dwParam2
2377 return midMessage(0, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
2380 /**************************************************************************
2381 * midiInMessage [MMSYSTEM.313]
2383 DWORD WINAPI midiInMessage16(HMIDIIN16 hMidiIn, UINT16 uMessage,
2384 DWORD dwParam1, DWORD dwParam2)
2386 LPMIDIOPENDESC lpDesc;
2387 dprintf_mmsys(stddeb, "midiInMessage(%04X, %04X, %08lX, %08lX)\n",
2388 hMidiIn, uMessage, dwParam1, dwParam2);
2389 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2390 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2393 fprintf(stderr,"midiInMessage16: can't handle MIDM_OPEN!\n");
2395 case MIDM_GETDEVCAPS:
2396 return midiInGetDevCaps16(hMidiIn,(LPMIDIINCAPS16)PTR_SEG_TO_LIN(dwParam1),dwParam2);
2397 case MIDM_GETNUMDEVS:
2402 /* no argument conversion needed */
2405 return midiInPrepareHeader16(hMidiIn,(LPMIDIHDR)PTR_SEG_TO_LIN(dwParam1),dwParam2);
2406 case MIDM_UNPREPARE:
2407 return midiInUnprepareHeader16(hMidiIn,(LPMIDIHDR)PTR_SEG_TO_LIN(dwParam1),dwParam2);
2408 case MIDM_ADDBUFFER:
2409 return midiInAddBuffer16(hMidiIn,(LPMIDIHDR)PTR_SEG_TO_LIN(dwParam1),dwParam2);
2411 fprintf(stderr,"unhandled midiInMessage16(%04x,%04x,%08lx,%08lx)\n",
2412 hMidiIn,uMessage,dwParam1,dwParam2
2416 return midMessage(0, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
2420 /**************************************************************************
2421 * waveOutGetNumDevs [MMSYSTEM.401]
2423 UINT32 WINAPI waveOutGetNumDevs32() {
2424 return waveOutGetNumDevs16();
2427 /**************************************************************************
2428 * waveOutGetNumDevs [WINMM.167]
2430 UINT16 WINAPI waveOutGetNumDevs16()
2433 dprintf_mmsys(stddeb, "waveOutGetNumDevs\n");
2434 count += wodMessage( MMSYSTEM_FirstDevID(), WODM_GETNUMDEVS, 0L, 0L, 0L);
2435 dprintf_mmsys(stddeb, "waveOutGetNumDevs return %u \n", count);
2439 /**************************************************************************
2440 * waveOutGetDevCaps [MMSYSTEM.402]
2442 UINT16 WINAPI waveOutGetDevCaps16(UINT16 uDeviceID, WAVEOUTCAPS16 * lpCaps,
2445 if (uDeviceID > waveOutGetNumDevs16() - 1) return MMSYSERR_BADDEVICEID;
2446 if (uDeviceID == (UINT16)WAVE_MAPPER) return MMSYSERR_BADDEVICEID; /* FIXME: do we have a wave mapper ? */
2447 dprintf_mmsys(stddeb, "waveOutGetDevCaps\n");
2448 return wodMessage(uDeviceID, WODM_GETDEVCAPS, 0L, (DWORD)lpCaps, uSize);
2451 /**************************************************************************
2452 * waveOutGetDevCapsA [WINMM.162]
2454 UINT32 WINAPI waveOutGetDevCaps32A(UINT32 uDeviceID, LPWAVEOUTCAPS32A lpCaps,
2457 WAVEOUTCAPS16 woc16;
2458 UINT16 ret = waveOutGetDevCaps16(uDeviceID,&woc16,sizeof(woc16));
2460 lpCaps->wMid = woc16.wMid;
2461 lpCaps->wPid = woc16.wPid;
2462 lpCaps->vDriverVersion = woc16.vDriverVersion;
2463 strcpy(lpCaps->szPname,woc16.szPname);
2464 lpCaps->dwFormats = woc16.dwFormats;
2465 lpCaps->wChannels = woc16.wChannels;
2466 lpCaps->dwSupport = woc16.dwSupport;
2470 /**************************************************************************
2471 * waveOutGetDevCapsW [WINMM.163]
2473 UINT32 WINAPI waveOutGetDevCaps32W(UINT32 uDeviceID, LPWAVEOUTCAPS32W lpCaps,
2476 WAVEOUTCAPS16 woc16;
2477 UINT32 ret = waveOutGetDevCaps16(uDeviceID,&woc16,sizeof(woc16));
2479 lpCaps->wMid = woc16.wMid;
2480 lpCaps->wPid = woc16.wPid;
2481 lpCaps->vDriverVersion = woc16.vDriverVersion;
2482 lstrcpyAtoW(lpCaps->szPname,woc16.szPname);
2483 lpCaps->dwFormats = woc16.dwFormats;
2484 lpCaps->wChannels = woc16.wChannels;
2485 lpCaps->dwSupport = woc16.dwSupport;
2489 /**************************************************************************
2490 * waveOutGetErrorText [MMSYSTEM.403]
2492 UINT16 WINAPI waveOutGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
2494 dprintf_mmsys(stddeb, "waveOutGetErrorText\n");
2495 return(waveGetErrorText(uError, lpText, uSize));
2498 /**************************************************************************
2499 * waveOutGetErrorTextA [WINMM.164]
2501 UINT32 WINAPI waveOutGetErrorText32A(UINT32 uError, LPSTR lpText, UINT32 uSize)
2503 return(waveOutGetErrorText16(uError, lpText, uSize));
2506 /**************************************************************************
2507 * waveOutGetErrorTextW [WINMM.165]
2509 UINT32 WINAPI waveOutGetErrorText32W(UINT32 uError, LPWSTR lpText, UINT32 uSize)
2511 LPSTR xstr = HeapAlloc(GetProcessHeap(),0,uSize);
2512 UINT32 ret = waveOutGetErrorText32A(uError, xstr, uSize);
2514 lstrcpyAtoW(lpText,xstr);
2515 HeapFree(GetProcessHeap(),0,xstr);
2520 /**************************************************************************
2521 * waveGetErrorText [internal]
2523 static UINT16 waveGetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize)
2526 dprintf_mmsys(stddeb, "waveGetErrorText(%04X, %p, %d);\n", uError, lpText, uSize);
2527 if ((lpText == NULL) || (uSize < 1)) return(FALSE);
2530 case MMSYSERR_NOERROR:
2531 msgptr = "The specified command was carried out.";
2533 case MMSYSERR_ERROR:
2534 msgptr = "Undefined external error.";
2536 case MMSYSERR_BADDEVICEID:
2537 msgptr = "A device ID has been used that is out of range for your system.";
2539 case MMSYSERR_NOTENABLED:
2540 msgptr = "The driver was not enabled.";
2542 case MMSYSERR_ALLOCATED:
2543 msgptr = "The specified device is already in use. Wait until it is free, and then try again.";
2545 case MMSYSERR_INVALHANDLE:
2546 msgptr = "The specified device handle is invalid.";
2548 case MMSYSERR_NODRIVER:
2549 msgptr = "There is no driver installed on your system !\n";
2551 case MMSYSERR_NOMEM:
2552 msgptr = "Not enough memory available for this task. Quit one or more applications to increase available memory, and then try again.";
2554 case MMSYSERR_NOTSUPPORTED:
2555 msgptr = "This function is not supported. Use the Capabilities function to determine which functions and messages the driver supports.";
2557 case MMSYSERR_BADERRNUM:
2558 msgptr = "An error number was specified that is not defined in the system.";
2560 case MMSYSERR_INVALFLAG:
2561 msgptr = "An invalid flag was passed to a system function.";
2563 case MMSYSERR_INVALPARAM:
2564 msgptr = "An invalid parameter was passed to a system function.";
2566 case WAVERR_BADFORMAT:
2567 msgptr = "The specified format is not supported or cannot be translated. Use the Capabilities function to determine the supported formats";
2569 case WAVERR_STILLPLAYING:
2570 msgptr = "Cannot perform this operation while media data is still playing. Reset the device, or wait until the data is finished playing.";
2572 case WAVERR_UNPREPARED:
2573 msgptr = "The wave header was not prepared. Use the Prepare function to prepare the header, and then try again.";
2576 msgptr = "Cannot open the device without using the WAVE_ALLOWSYNC flag. Use the flag, and then try again.";
2579 msgptr = "Unknown MMSYSTEM Error !\n";
2582 lstrcpyn32A(lpText, msgptr, uSize);
2586 /**************************************************************************
2587 * waveOutOpen [WINMM.173]
2588 * All the args/structs have the same layout as the win16 equivalents
2590 UINT32 WINAPI waveOutOpen32(HWAVEOUT32 * lphWaveOut, UINT32 uDeviceID,
2591 const LPWAVEFORMATEX lpFormat, DWORD dwCallback,
2592 DWORD dwInstance, DWORD dwFlags)
2595 UINT32 ret=waveOutOpen16(&hwo16,uDeviceID,lpFormat,dwCallback,dwInstance,dwFlags);
2596 if (lphWaveOut) *lphWaveOut=hwo16;
2599 /**************************************************************************
2600 * waveOutOpen [MMSYSTEM.404]
2602 UINT16 WINAPI waveOutOpen16(HWAVEOUT16 * lphWaveOut, UINT16 uDeviceID,
2603 const LPWAVEFORMATEX lpFormat, DWORD dwCallback,
2604 DWORD dwInstance, DWORD dwFlags)
2606 HWAVEOUT16 hWaveOut;
2607 LPWAVEOPENDESC lpDesc;
2609 BOOL32 bMapperFlg = FALSE;
2611 dprintf_mmsys(stddeb, "waveOutOpen(%p, %d, %p, %08lX, %08lX, %08lX);\n",
2612 lphWaveOut, uDeviceID, lpFormat, dwCallback, dwInstance, dwFlags);
2613 if (dwFlags & WAVE_FORMAT_QUERY)
2614 dprintf_mmsys(stddeb, "waveOutOpen // WAVE_FORMAT_QUERY requested !\n");
2615 if (uDeviceID == (UINT16)WAVE_MAPPER) {
2616 dprintf_mmsys(stddeb, "waveOutOpen // WAVE_MAPPER mode requested !\n");
2620 if (lpFormat == NULL) return WAVERR_BADFORMAT;
2622 hWaveOut = USER_HEAP_ALLOC(sizeof(WAVEOPENDESC));
2623 if (lphWaveOut != NULL) *lphWaveOut = hWaveOut;
2624 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2625 if (lpDesc == NULL) return MMSYSERR_NOMEM;
2626 lpDesc->hWave = hWaveOut;
2627 lpDesc->lpFormat = (LPWAVEFORMAT)lpFormat; /* should the struct be copied iso pointer? */
2628 lpDesc->dwCallBack = dwCallback;
2629 lpDesc->dwInstance = dwInstance;
2630 if (uDeviceID >= MAXWAVEDRIVERS)
2632 while(uDeviceID < MAXWAVEDRIVERS) {
2633 dwRet = wodMessage(uDeviceID, WODM_OPEN,
2634 lpDesc->dwInstance, (DWORD)lpDesc, dwFlags);
2635 if (dwRet == MMSYSERR_NOERROR) break;
2636 if (!bMapperFlg) break;
2638 dprintf_mmsys(stddeb, "waveOutOpen // WAVE_MAPPER mode ! try next driver...\n");
2640 lpDesc->uDeviceID = uDeviceID; /* save physical Device ID */
2641 if (dwFlags & WAVE_FORMAT_QUERY) {
2642 dprintf_mmsys(stddeb, "waveOutOpen // End of WAVE_FORMAT_QUERY !\n");
2643 dwRet = waveOutClose32(hWaveOut);
2648 /**************************************************************************
2649 * waveOutClose [WINMM.161]
2651 UINT32 WINAPI waveOutClose32(HWAVEOUT32 hWaveOut)
2653 return waveOutClose16(hWaveOut);
2655 /**************************************************************************
2656 * waveOutClose [MMSYSTEM.405]
2658 UINT16 WINAPI waveOutClose16(HWAVEOUT16 hWaveOut)
2660 LPWAVEOPENDESC lpDesc;
2662 dprintf_mmsys(stddeb, "waveOutClose(%04X)\n", hWaveOut);
2663 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2664 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2665 return wodMessage( lpDesc->uDeviceID, WODM_CLOSE, lpDesc->dwInstance, 0L, 0L);
2668 /**************************************************************************
2669 * waveOutPrepareHeader [WINMM.175]
2671 UINT32 WINAPI waveOutPrepareHeader32(HWAVEOUT32 hWaveOut,
2672 WAVEHDR * lpWaveOutHdr, UINT32 uSize)
2674 LPWAVEOPENDESC lpDesc;
2676 dprintf_mmsys(stddeb, "waveOutPrepareHeader(%04X, %p, %u);\n",
2677 hWaveOut, lpWaveOutHdr, uSize);
2678 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2679 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2680 return wodMessage( lpDesc->uDeviceID, WODM_PREPARE, lpDesc->dwInstance,
2681 (DWORD)lpWaveOutHdr,uSize);
2683 /**************************************************************************
2684 * waveOutPrepareHeader [MMSYSTEM.406]
2686 UINT16 WINAPI waveOutPrepareHeader16(HWAVEOUT16 hWaveOut,
2687 WAVEHDR * lpWaveOutHdr, UINT16 uSize)
2689 LPWAVEOPENDESC lpDesc;
2690 LPBYTE saveddata = lpWaveOutHdr->lpData;
2693 dprintf_mmsys(stddeb, "waveOutPrepareHeader(%04X, %p, %u);\n",
2694 hWaveOut, lpWaveOutHdr, uSize);
2695 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2696 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2697 lpWaveOutHdr->lpData = PTR_SEG_TO_LIN(lpWaveOutHdr->lpData);
2698 ret = wodMessage( lpDesc->uDeviceID, WODM_PREPARE, lpDesc->dwInstance,
2699 (DWORD)lpWaveOutHdr,uSize);
2700 lpWaveOutHdr->lpData = saveddata;
2704 /**************************************************************************
2705 * waveOutUnprepareHeader [WINMM.181]
2707 UINT32 WINAPI waveOutUnprepareHeader32(HWAVEOUT32 hWaveOut,
2708 WAVEHDR * lpWaveOutHdr, UINT32 uSize)
2710 LPWAVEOPENDESC lpDesc;
2712 dprintf_mmsys(stddeb, "waveOutUnprepareHeader(%04X, %p, %u);\n",
2713 hWaveOut, lpWaveOutHdr, uSize);
2714 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2715 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2716 return wodMessage(lpDesc->uDeviceID,WODM_UNPREPARE,lpDesc->dwInstance,
2717 (DWORD)lpWaveOutHdr, uSize);
2719 /**************************************************************************
2720 * waveOutUnprepareHeader [MMSYSTEM.407]
2722 UINT16 WINAPI waveOutUnprepareHeader16(HWAVEOUT16 hWaveOut,
2723 WAVEHDR * lpWaveOutHdr, UINT16 uSize)
2725 LPWAVEOPENDESC lpDesc;
2726 LPBYTE saveddata = lpWaveOutHdr->lpData;
2729 dprintf_mmsys(stddeb, "waveOutUnprepareHeader(%04X, %p, %u);\n",
2730 hWaveOut, lpWaveOutHdr, uSize);
2731 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2732 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2733 lpWaveOutHdr->lpData = PTR_SEG_TO_LIN(lpWaveOutHdr->lpData);
2734 ret = wodMessage(lpDesc->uDeviceID,WODM_UNPREPARE,lpDesc->dwInstance,
2735 (DWORD)lpWaveOutHdr, uSize);
2736 lpWaveOutHdr->lpData = saveddata;
2740 /**************************************************************************
2741 * waveOutWrite [MMSYSTEM.408]
2743 UINT32 WINAPI waveOutWrite32(HWAVEOUT32 hWaveOut, WAVEHDR * lpWaveOutHdr,
2746 LPWAVEOPENDESC lpDesc;
2747 dprintf_mmsys(stddeb, "waveOutWrite(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
2748 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2749 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2750 lpWaveOutHdr->reserved = (DWORD)lpWaveOutHdr->lpData;
2751 return wodMessage( lpDesc->uDeviceID, WODM_WRITE, lpDesc->dwInstance, (DWORD)lpWaveOutHdr, uSize);
2753 /**************************************************************************
2754 * waveOutWrite [MMSYSTEM.408]
2756 UINT16 WINAPI waveOutWrite16(HWAVEOUT16 hWaveOut, WAVEHDR * lpWaveOutHdr,
2759 LPWAVEOPENDESC lpDesc;
2762 dprintf_mmsys(stddeb, "waveOutWrite(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
2763 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2764 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2765 lpWaveOutHdr->reserved=(DWORD)lpWaveOutHdr->lpData;/*save original ptr*/
2766 lpWaveOutHdr->lpData = PTR_SEG_TO_LIN(lpWaveOutHdr->lpData);
2767 ret = wodMessage( lpDesc->uDeviceID, WODM_WRITE, lpDesc->dwInstance, (DWORD)lpWaveOutHdr, uSize);
2768 lpWaveOutHdr->lpData = (LPBYTE)lpWaveOutHdr->reserved;
2772 /**************************************************************************
2773 * waveOutPause [WINMM.174]
2775 UINT32 WINAPI waveOutPause32(HWAVEOUT32 hWaveOut)
2777 return waveOutPause16(hWaveOut);
2780 /**************************************************************************
2781 * waveOutPause [MMSYSTEM.409]
2783 UINT16 WINAPI waveOutPause16(HWAVEOUT16 hWaveOut)
2785 LPWAVEOPENDESC lpDesc;
2787 dprintf_mmsys(stddeb, "waveOutPause(%04X)\n", hWaveOut);
2788 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2789 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2790 return wodMessage( lpDesc->uDeviceID, WODM_PAUSE, lpDesc->dwInstance, 0L, 0L);
2793 /**************************************************************************
2794 * waveOutRestart [WINMM.177]
2796 UINT32 WINAPI waveOutRestart32(HWAVEOUT32 hWaveOut)
2798 return waveOutRestart16(hWaveOut);
2800 /**************************************************************************
2801 * waveOutRestart [MMSYSTEM.410]
2803 UINT16 WINAPI waveOutRestart16(HWAVEOUT16 hWaveOut)
2805 LPWAVEOPENDESC lpDesc;
2807 dprintf_mmsys(stddeb, "waveOutRestart(%04X)\n", hWaveOut);
2808 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2809 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2810 return wodMessage( lpDesc->uDeviceID, WODM_RESTART, lpDesc->dwInstance, 0L, 0L);
2813 /**************************************************************************
2814 * waveOutReset [WINMM.176]
2816 UINT32 WINAPI waveOutReset32(HWAVEOUT32 hWaveOut)
2818 return waveOutReset16(hWaveOut);
2821 /**************************************************************************
2822 * waveOutReset [MMSYSTEM.411]
2824 UINT16 WINAPI waveOutReset16(HWAVEOUT16 hWaveOut)
2826 LPWAVEOPENDESC lpDesc;
2827 dprintf_mmsys(stddeb, "waveOutReset(%04X)\n", hWaveOut);
2828 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2829 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2830 return wodMessage( lpDesc->uDeviceID, WODM_RESET, lpDesc->dwInstance, 0L, 0L);
2833 /**************************************************************************
2834 * waveOutGetPosition [WINMM.170]
2836 UINT32 WINAPI waveOutGetPosition32(HWAVEOUT32 hWaveOut, LPMMTIME32 lpTime,
2840 UINT32 ret = waveOutGetPosition16(hWaveOut,&mmt16,sizeof(mmt16));
2841 MMSYSTEM_MMTIME16to32(lpTime,&mmt16);
2844 /**************************************************************************
2845 * waveOutGetPosition [MMSYSTEM.412]
2847 UINT16 WINAPI waveOutGetPosition16(HWAVEOUT16 hWaveOut,LPMMTIME16 lpTime,
2850 LPWAVEOPENDESC lpDesc;
2851 dprintf_mmsys(stddeb, "waveOutGetPosition(%04X, %p, %u);\n", hWaveOut, lpTime, uSize);
2852 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2853 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2854 return wodMessage( lpDesc->uDeviceID, WODM_GETPOS, lpDesc->dwInstance,
2855 (DWORD)lpTime, (DWORD)uSize);
2858 #define WAVEOUT_SHORTCUT_1(xx,XX,atype) \
2859 UINT32 WINAPI waveOut##xx##32(HWAVEOUT32 hWaveOut, atype x) \
2861 return waveOut##xx##16(hWaveOut,x); \
2863 UINT16 WINAPI waveOut##xx##16(HWAVEOUT16 hWaveOut, atype x) \
2865 LPWAVEOPENDESC lpDesc; \
2866 dprintf_mmsys(stddeb, "waveOut"#xx"(%04X, %08lx);\n", hWaveOut,(DWORD)x);\
2867 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut); \
2868 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE; \
2869 return wodMessage(lpDesc->uDeviceID, WODM_##XX, lpDesc->dwInstance,\
2873 WAVEOUT_SHORTCUT_1(GetPitch,GETPITCH,DWORD*)
2874 WAVEOUT_SHORTCUT_1(SetPitch,SETPITCH,DWORD)
2875 WAVEOUT_SHORTCUT_1(GetPlaybackRate,GETPLAYBACKRATE,DWORD*)
2876 WAVEOUT_SHORTCUT_1(SetPlaybackRate,SETPLAYBACKRATE,DWORD)
2878 #define WAVEOUT_SHORTCUT_2(xx,XX,atype) \
2879 UINT32 WINAPI waveOut##xx##32(UINT32 devid, atype x) \
2881 return waveOut##xx##16(devid,x); \
2883 UINT16 WINAPI waveOut##xx##16(UINT16 devid, atype x) \
2885 dprintf_mmsys(stddeb, "waveOut"#xx"(%04X, %08lx);\n", devid,(DWORD)x); \
2886 return wodMessage(devid, WODM_##XX, 0L, (DWORD)x, 0L); \
2890 WAVEOUT_SHORTCUT_2(GetVolume,GETVOLUME,DWORD*)
2891 WAVEOUT_SHORTCUT_2(SetVolume,SETVOLUME,DWORD)
2894 /**************************************************************************
2895 * waveOutBreakLoop [MMSYSTEM.419]
2897 UINT32 WINAPI waveOutBreakLoop32(HWAVEOUT32 hWaveOut)
2899 return waveOutBreakLoop16(hWaveOut);
2901 /**************************************************************************
2902 * waveOutBreakLoop [MMSYSTEM.419]
2904 UINT16 WINAPI waveOutBreakLoop16(HWAVEOUT16 hWaveOut)
2906 dprintf_mmsys(stddeb, "waveOutBreakLoop(%04X)\n", hWaveOut);
2907 return MMSYSERR_INVALHANDLE;
2910 /**************************************************************************
2911 * waveOutGetID [MMSYSTEM.420]
2913 UINT32 WINAPI waveOutGetID32(HWAVEOUT32 hWaveOut, UINT32 * lpuDeviceID)
2915 LPWAVEOPENDESC lpDesc;
2916 dprintf_mmsys(stddeb, "waveOutGetID(%04X, %p);\n", hWaveOut, lpuDeviceID);
2917 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2918 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2919 if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
2920 *lpuDeviceID = lpDesc->uDeviceID;
2923 /**************************************************************************
2924 * waveOutGetID [MMSYSTEM.420]
2926 UINT16 WINAPI waveOutGetID16(HWAVEOUT16 hWaveOut, UINT16 * lpuDeviceID)
2928 LPWAVEOPENDESC lpDesc;
2929 dprintf_mmsys(stddeb, "waveOutGetID(%04X, %p);\n", hWaveOut, lpuDeviceID);
2930 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2931 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2932 if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
2933 *lpuDeviceID = lpDesc->uDeviceID;
2937 /**************************************************************************
2938 * waveOutMessage [MMSYSTEM.421]
2940 DWORD WINAPI waveOutMessage32(HWAVEOUT32 hWaveOut, UINT32 uMessage,
2941 DWORD dwParam1, DWORD dwParam2)
2943 LPWAVEOPENDESC lpDesc;
2945 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2946 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2948 case WODM_GETNUMDEVS:
2950 case WODM_GETVOLUME:
2952 case WODM_GETPLAYBACKRATE:
2953 case WODM_SETVOLUME:
2955 case WODM_SETPLAYBACKRATE:
2959 case WODM_UNPREPARE:
2962 /* no argument conversion needed */
2965 return waveOutWrite32(hWaveOut,(LPWAVEHDR)dwParam1,dwParam2);
2966 case WODM_GETDEVCAPS:
2967 /* FIXME: UNICODE/ANSI? */
2968 return waveOutGetDevCaps32A(hWaveOut,(LPWAVEOUTCAPS32A)dwParam1,dwParam2);
2970 fprintf(stderr,"waveOutMessage32 can't handle WODM_OPEN, please report.\n");
2973 fprintf(stderr,"unhandled waveOutMessage32(0x%04x,0x%04x,%08lx,%08lx)\n",
2974 hWaveOut,uMessage,dwParam1,dwParam2
2978 return wodMessage( lpDesc->uDeviceID, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
2981 /**************************************************************************
2982 * waveOutMessage [MMSYSTEM.421]
2984 DWORD WINAPI waveOutMessage16(HWAVEOUT16 hWaveOut, UINT16 uMessage,
2985 DWORD dwParam1, DWORD dwParam2)
2987 LPWAVEOPENDESC lpDesc;
2989 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
2990 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2992 case WODM_GETNUMDEVS:
2993 case WODM_SETVOLUME:
2995 case WODM_SETPLAYBACKRATE:
3000 /* no argument conversion needed */
3003 return waveOutGetPosition16(hWaveOut,(LPMMTIME16)PTR_SEG_TO_LIN(dwParam1),dwParam2);
3004 case WODM_GETVOLUME:
3005 return waveOutGetVolume16(hWaveOut,(LPDWORD)PTR_SEG_TO_LIN(dwParam1));
3007 return waveOutGetPitch16(hWaveOut,(LPDWORD)PTR_SEG_TO_LIN(dwParam1));
3008 case WODM_GETPLAYBACKRATE:
3009 return waveOutGetPlaybackRate16(hWaveOut,(LPDWORD)PTR_SEG_TO_LIN(dwParam1));
3010 case WODM_GETDEVCAPS:
3011 return waveOutGetDevCaps16(hWaveOut,(LPWAVEOUTCAPS16)PTR_SEG_TO_LIN(dwParam1),dwParam2);
3013 return waveOutPrepareHeader16(hWaveOut,(LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1),dwParam2);
3014 case WODM_UNPREPARE:
3015 return waveOutUnprepareHeader16(hWaveOut,(LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1),dwParam2);
3017 return waveOutWrite16(hWaveOut,(LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1),dwParam2);
3019 fprintf(stderr,"waveOutMessage16 can't handle WODM_OPEN, please report.\n");
3022 fprintf(stderr,"unhandled waveOutMessage16(0x%04x,0x%04x,%08lx,%08lx)\n",
3023 hWaveOut,uMessage,dwParam1,dwParam2
3026 return wodMessage( lpDesc->uDeviceID, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
3029 /**************************************************************************
3030 * waveInGetNumDevs [WINMM.151]
3032 UINT32 WINAPI waveInGetNumDevs32()
3034 return waveInGetNumDevs16();
3037 /**************************************************************************
3038 * waveInGetNumDevs [MMSYSTEM.501]
3040 UINT16 WINAPI waveInGetNumDevs16()
3043 dprintf_mmsys(stddeb, "waveInGetNumDevs\n");
3044 count += widMessage(0, WIDM_GETNUMDEVS, 0L, 0L, 0L);
3045 dprintf_mmsys(stddeb, "waveInGetNumDevs return %u \n", count);
3049 /**************************************************************************
3050 * waveInGetDevCapsA [WINMM.147]
3052 UINT32 WINAPI waveInGetDevCaps32W(UINT32 uDeviceID, LPWAVEINCAPS32W lpCaps, UINT32 uSize)
3055 UINT32 ret = waveInGetDevCaps16(uDeviceID,&wic16,uSize);
3057 lpCaps->wMid = wic16.wMid;
3058 lpCaps->wPid = wic16.wPid;
3059 lpCaps->vDriverVersion = wic16.vDriverVersion;
3060 lstrcpyAtoW(lpCaps->szPname,wic16.szPname);
3061 lpCaps->dwFormats = wic16.dwFormats;
3062 lpCaps->wChannels = wic16.wChannels;
3066 /**************************************************************************
3067 * waveInGetDevCapsA [WINMM.146]
3069 UINT32 WINAPI waveInGetDevCaps32A(UINT32 uDeviceID, LPWAVEINCAPS32A lpCaps, UINT32 uSize)
3072 UINT32 ret = waveInGetDevCaps16(uDeviceID,&wic16,uSize);
3074 lpCaps->wMid = wic16.wMid;
3075 lpCaps->wPid = wic16.wPid;
3076 lpCaps->vDriverVersion = wic16.vDriverVersion;
3077 strcpy(lpCaps->szPname,wic16.szPname);
3078 lpCaps->dwFormats = wic16.dwFormats;
3079 lpCaps->wChannels = wic16.wChannels;
3082 /**************************************************************************
3083 * waveInGetDevCaps [MMSYSTEM.502]
3085 UINT16 WINAPI waveInGetDevCaps16(UINT16 uDeviceID, LPWAVEINCAPS16 lpCaps, UINT16 uSize)
3087 dprintf_mmsys(stddeb, "waveInGetDevCaps\n");
3088 return widMessage(uDeviceID, WIDM_GETDEVCAPS, 0L, (DWORD)lpCaps, uSize);
3091 /**************************************************************************
3092 * waveInGetErrorTextA [WINMM.148]
3094 UINT32 WINAPI waveInGetErrorText32A(UINT32 uError, LPSTR lpText, UINT32 uSize)
3096 dprintf_mmsys(stddeb, "waveInGetErrorText\n");
3097 return(waveGetErrorText(uError, lpText, uSize));
3100 /**************************************************************************
3101 * waveInGetErrorTextW [WINMM.149]
3103 UINT32 WINAPI waveInGetErrorText32W(UINT32 uError, LPWSTR lpText, UINT32 uSize)
3105 LPSTR txt = HeapAlloc(GetProcessHeap(),0,uSize);
3106 UINT32 ret = waveGetErrorText(uError, txt, uSize);
3108 lstrcpyAtoW(lpText,txt);
3109 HeapFree(GetProcessHeap(),0,txt);
3113 /**************************************************************************
3114 * waveInGetErrorText [MMSYSTEM.503]
3116 UINT16 WINAPI waveInGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
3118 dprintf_mmsys(stddeb, "waveInGetErrorText\n");
3119 return(waveGetErrorText(uError, lpText, uSize));
3123 /**************************************************************************
3124 * waveInOpen [WINMM.154]
3126 UINT32 WINAPI waveInOpen32(HWAVEIN32 * lphWaveIn, UINT32 uDeviceID,
3127 const LPWAVEFORMAT lpFormat, DWORD dwCallback,
3128 DWORD dwInstance, DWORD dwFlags)
3131 UINT32 ret=waveInOpen16(&hwin16,uDeviceID,lpFormat,dwCallback,dwInstance,dwFlags);
3132 if (lphWaveIn) *lphWaveIn = hwin16;
3136 /**************************************************************************
3137 * waveInOpen [MMSYSTEM.504]
3139 UINT16 WINAPI waveInOpen16(HWAVEIN16 * lphWaveIn, UINT16 uDeviceID,
3140 const LPWAVEFORMAT lpFormat, DWORD dwCallback,
3141 DWORD dwInstance, DWORD dwFlags)
3144 LPWAVEOPENDESC lpDesc;
3146 BOOL32 bMapperFlg = FALSE;
3147 dprintf_mmsys(stddeb, "waveInOpen(%p, %d, %p, %08lX, %08lX, %08lX);\n",
3148 lphWaveIn, uDeviceID, lpFormat, dwCallback, dwInstance, dwFlags);
3149 if (dwFlags & WAVE_FORMAT_QUERY)
3150 dprintf_mmsys(stddeb, "waveInOpen // WAVE_FORMAT_QUERY requested !\n");
3151 if (uDeviceID == (UINT16)WAVE_MAPPER) {
3152 dprintf_mmsys(stddeb, "waveInOpen // WAVE_MAPPER mode requested !\n");
3156 if (lpFormat == NULL) return WAVERR_BADFORMAT;
3157 hWaveIn = USER_HEAP_ALLOC(sizeof(WAVEOPENDESC));
3158 if (lphWaveIn != NULL) *lphWaveIn = hWaveIn;
3159 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3160 if (lpDesc == NULL) return MMSYSERR_NOMEM;
3161 lpDesc->hWave = hWaveIn;
3162 lpDesc->lpFormat = lpFormat;
3163 lpDesc->dwCallBack = dwCallback;
3164 lpDesc->dwInstance = dwInstance;
3165 while(uDeviceID < MAXWAVEDRIVERS) {
3166 dwRet = widMessage(uDeviceID, WIDM_OPEN,
3167 lpDesc->dwInstance, (DWORD)lpDesc, 0L);
3168 if (dwRet == MMSYSERR_NOERROR) break;
3169 if (!bMapperFlg) break;
3171 dprintf_mmsys(stddeb, "waveInOpen // WAVE_MAPPER mode ! try next driver...\n");
3173 lpDesc->uDeviceID = uDeviceID;
3174 if (dwFlags & WAVE_FORMAT_QUERY) {
3175 dprintf_mmsys(stddeb, "waveInOpen // End of WAVE_FORMAT_QUERY !\n");
3176 dwRet = waveInClose16(hWaveIn);
3181 /**************************************************************************
3182 * waveInClose [WINMM.145]
3184 UINT32 WINAPI waveInClose32(HWAVEIN32 hWaveIn)
3186 return waveInClose16(hWaveIn);
3188 /**************************************************************************
3189 * waveInClose [MMSYSTEM.505]
3191 UINT16 WINAPI waveInClose16(HWAVEIN16 hWaveIn)
3193 LPWAVEOPENDESC lpDesc;
3195 dprintf_mmsys(stddeb, "waveInClose(%04X)\n", hWaveIn);
3196 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3197 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3198 return widMessage(lpDesc->uDeviceID, WIDM_CLOSE, lpDesc->dwInstance, 0L, 0L);
3201 /**************************************************************************
3202 * waveInPrepareHeader [WINMM.155]
3204 UINT32 WINAPI waveInPrepareHeader32(HWAVEIN32 hWaveIn,
3205 WAVEHDR * lpWaveInHdr, UINT32 uSize)
3207 LPWAVEOPENDESC lpDesc;
3209 dprintf_mmsys(stddeb, "waveInPrepareHeader(%04X, %p, %u);\n",
3210 hWaveIn, lpWaveInHdr, uSize);
3211 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3212 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3213 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
3214 lpWaveInHdr = lpWaveInHdr;
3215 lpWaveInHdr->lpNext = NULL;
3216 lpWaveInHdr->dwBytesRecorded = 0;
3217 dprintf_mmsys(stddeb, "waveInPrepareHeader // lpData=%p size=%lu \n",
3218 lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
3219 return widMessage(lpDesc->uDeviceID,WIDM_PREPARE,lpDesc->dwInstance,
3220 (DWORD)lpWaveInHdr, uSize);
3222 /**************************************************************************
3223 * waveInPrepareHeader [MMSYSTEM.506]
3225 UINT16 WINAPI waveInPrepareHeader16(HWAVEIN16 hWaveIn,
3226 WAVEHDR * lpWaveInHdr, UINT16 uSize)
3228 LPWAVEOPENDESC lpDesc;
3229 LPBYTE saveddata = lpWaveInHdr->lpData;
3232 dprintf_mmsys(stddeb, "waveInPrepareHeader(%04X, %p, %u);\n",
3233 hWaveIn, lpWaveInHdr, uSize);
3234 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3235 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3236 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
3237 lpWaveInHdr = lpWaveInHdr;
3238 lpWaveInHdr->lpNext = NULL;
3239 lpWaveInHdr->dwBytesRecorded = 0;
3241 dprintf_mmsys(stddeb, "waveInPrepareHeader // lpData=%p size=%lu \n",
3242 lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
3243 lpWaveInHdr->lpData = PTR_SEG_TO_LIN(lpWaveInHdr->lpData);
3244 ret = widMessage(lpDesc->uDeviceID,WIDM_PREPARE,lpDesc->dwInstance,
3245 (DWORD)lpWaveInHdr,uSize);
3246 lpWaveInHdr->lpData = saveddata;
3251 /**************************************************************************
3252 * waveInUnprepareHeader [WINMM.159]
3254 UINT32 WINAPI waveInUnprepareHeader32(HWAVEIN32 hWaveIn,
3255 WAVEHDR * lpWaveInHdr, UINT32 uSize)
3257 LPWAVEOPENDESC lpDesc;
3259 dprintf_mmsys(stddeb, "waveInUnprepareHeader(%04X, %p, %u);\n",
3260 hWaveIn, lpWaveInHdr, uSize);
3261 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3262 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3263 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
3264 /*USER_HEAP_FREE(HIWORD((DWORD)lpWaveInHdr->lpData)); FIXME */
3265 lpWaveInHdr->lpData = NULL;
3266 lpWaveInHdr->lpNext = NULL;
3267 return widMessage(lpDesc->uDeviceID,WIDM_UNPREPARE,lpDesc->dwInstance,
3268 (DWORD)lpWaveInHdr, uSize);
3270 /**************************************************************************
3271 * waveInUnprepareHeader [MMSYSTEM.507]
3273 UINT16 WINAPI waveInUnprepareHeader16(HWAVEIN16 hWaveIn,
3274 WAVEHDR * lpWaveInHdr, UINT16 uSize)
3276 LPWAVEOPENDESC lpDesc;
3278 dprintf_mmsys(stddeb, "waveInUnprepareHeader(%04X, %p, %u);\n",
3279 hWaveIn, lpWaveInHdr, uSize);
3280 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3281 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3282 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
3283 /*USER_HEAP_FREE(HIWORD((DWORD)lpWaveInHdr->lpData)); FIXME */
3284 lpWaveInHdr->lpData = NULL;
3285 lpWaveInHdr->lpNext = NULL;
3286 return widMessage(lpDesc->uDeviceID,WIDM_UNPREPARE,lpDesc->dwInstance,
3287 (DWORD)lpWaveInHdr, uSize);
3290 /**************************************************************************
3291 * waveInAddBuffer [WINMM.144]
3293 UINT32 WINAPI waveInAddBuffer32(HWAVEIN32 hWaveIn,
3294 WAVEHDR * lpWaveInHdr, UINT32 uSize)
3296 LPWAVEOPENDESC lpDesc;
3298 dprintf_mmsys(stddeb, "waveInAddBuffer(%04X, %p, %u);\n", hWaveIn, lpWaveInHdr, uSize);
3299 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3300 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3301 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
3302 lpWaveInHdr->lpNext = NULL;
3303 lpWaveInHdr->dwBytesRecorded = 0;
3304 dprintf_mmsys(stddeb, "waveInAddBuffer // lpData=%p size=%lu \n",
3305 lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
3306 return widMessage(lpDesc->uDeviceID, WIDM_ADDBUFFER, lpDesc->dwInstance,
3307 (DWORD)lpWaveInHdr, uSize);
3311 /**************************************************************************
3312 * waveInAddBuffer [MMSYSTEM.508]
3314 UINT16 WINAPI waveInAddBuffer16(HWAVEIN16 hWaveIn,
3315 WAVEHDR * lpWaveInHdr, UINT16 uSize)
3317 LPWAVEOPENDESC lpDesc;
3320 dprintf_mmsys(stddeb, "waveInAddBuffer(%04X, %p, %u);\n", hWaveIn, lpWaveInHdr, uSize);
3321 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3322 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3323 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
3324 lpWaveInHdr->lpNext = NULL;
3325 lpWaveInHdr->dwBytesRecorded = 0;
3326 lpWaveInHdr->lpData = PTR_SEG_TO_LIN(lpWaveInHdr->lpData);
3327 dprintf_mmsys(stddeb, "waveInAddBuffer // lpData=%p size=%lu \n",
3328 lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
3329 ret = widMessage(lpDesc->uDeviceID, WIDM_ADDBUFFER, lpDesc->dwInstance,
3330 (DWORD)lpWaveInHdr, uSize);
3331 /*lpWaveInHdr->lpData = saveddata;*/
3335 /**************************************************************************
3336 * waveInStart [WINMM.157]
3338 UINT32 WINAPI waveInStart32(HWAVEIN32 hWaveIn)
3340 return waveInStart16(hWaveIn);
3343 /**************************************************************************
3344 * waveInStart [MMSYSTEM.509]
3346 UINT16 WINAPI waveInStart16(HWAVEIN16 hWaveIn)
3348 LPWAVEOPENDESC lpDesc;
3350 dprintf_mmsys(stddeb, "waveInStart(%04X)\n", hWaveIn);
3351 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3352 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3353 return widMessage(lpDesc->uDeviceID,WIDM_START,lpDesc->dwInstance,0,0);
3356 /**************************************************************************
3357 * waveInStop [WINMM.158]
3359 UINT32 WINAPI waveInStop32(HWAVEIN32 hWaveIn)
3361 return waveInStop16(hWaveIn);
3364 /**************************************************************************
3365 * waveInStop [MMSYSTEM.510]
3367 UINT16 WINAPI waveInStop16(HWAVEIN16 hWaveIn)
3369 LPWAVEOPENDESC lpDesc;
3371 dprintf_mmsys(stddeb, "waveInStop(%04X)\n", hWaveIn);
3372 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3373 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3374 return widMessage(lpDesc->uDeviceID, WIDM_STOP, lpDesc->dwInstance, 0L, 0L);
3377 /**************************************************************************
3378 * waveInReset [WINMM.156]
3380 UINT32 WINAPI waveInReset32(HWAVEIN32 hWaveIn)
3382 return waveInReset16(hWaveIn);
3385 /**************************************************************************
3386 * waveInReset [MMSYSTEM.511]
3388 UINT16 WINAPI waveInReset16(HWAVEIN16 hWaveIn)
3390 LPWAVEOPENDESC lpDesc;
3392 dprintf_mmsys(stddeb, "waveInReset(%04X)\n", hWaveIn);
3393 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3394 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3395 return widMessage(lpDesc->uDeviceID,WIDM_RESET,lpDesc->dwInstance,0,0);
3398 /**************************************************************************
3399 * waveInGetPosition [WINMM.152]
3401 UINT32 WINAPI waveInGetPosition32(HWAVEIN32 hWaveIn, LPMMTIME32 lpTime,
3405 UINT32 ret = waveInGetPosition16(hWaveIn,&mmt16,uSize);
3407 MMSYSTEM_MMTIME16to32(lpTime,&mmt16);
3411 /**************************************************************************
3412 * waveInGetPosition [MMSYSTEM.512]
3414 UINT16 WINAPI waveInGetPosition16(HWAVEIN16 hWaveIn,LPMMTIME16 lpTime,
3417 LPWAVEOPENDESC lpDesc;
3419 dprintf_mmsys(stddeb, "waveInGetPosition(%04X, %p, %u);\n", hWaveIn, lpTime, uSize);
3420 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3421 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3422 return widMessage(lpDesc->uDeviceID, WIDM_GETPOS, lpDesc->dwInstance,
3423 (DWORD)lpTime, (DWORD)uSize);
3426 /**************************************************************************
3427 * waveInGetID [WINMM.150]
3429 UINT32 WINAPI waveInGetID32(HWAVEIN32 hWaveIn, UINT32 * lpuDeviceID)
3431 LPWAVEOPENDESC lpDesc;
3433 dprintf_mmsys(stddeb, "waveInGetID\n");
3434 if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
3435 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3436 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3437 *lpuDeviceID = lpDesc->uDeviceID;
3442 /**************************************************************************
3443 * waveInGetID [MMSYSTEM.513]
3445 UINT16 WINAPI waveInGetID16(HWAVEIN16 hWaveIn, UINT16 * lpuDeviceID)
3447 LPWAVEOPENDESC lpDesc;
3449 dprintf_mmsys(stddeb, "waveInGetID\n");
3450 if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
3451 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3452 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3453 *lpuDeviceID = lpDesc->uDeviceID;
3457 /**************************************************************************
3458 * waveInMessage [WINMM.153]
3460 DWORD WINAPI waveInMessage32(HWAVEIN32 hWaveIn, UINT32 uMessage,
3461 DWORD dwParam1, DWORD dwParam2)
3463 LPWAVEOPENDESC lpDesc;
3465 fprintf(stderr, "waveInMessage32(%04X, %04X, %08lX, %08lX),FIXME!\n",
3466 hWaveIn, uMessage, dwParam1, dwParam2);
3467 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3468 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3471 fprintf(stderr,"waveInMessage32: cannot handle WIDM_OPEN, please report.\n");
3473 case WIDM_GETNUMDEVS:
3480 case WIDM_UNPREPARE:
3481 case WIDM_ADDBUFFER:
3483 /* no argument conversion needed */
3485 case WIDM_GETDEVCAPS:
3486 /*FIXME: ANSI/UNICODE */
3487 return waveInGetDevCaps32A(hWaveIn,(LPWAVEINCAPS32A)dwParam1,dwParam2);
3489 fprintf(stderr,"unhandled waveInMessage32(%04x,%04x,%08lx,%08lx)\n",hWaveIn,uMessage,dwParam1,dwParam2);
3492 return widMessage(lpDesc->uDeviceID, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
3495 /**************************************************************************
3496 * waveInMessage [MMSYSTEM.514]
3498 DWORD WINAPI waveInMessage16(HWAVEIN16 hWaveIn, UINT16 uMessage,
3499 DWORD dwParam1, DWORD dwParam2)
3501 LPWAVEOPENDESC lpDesc;
3503 fprintf(stderr, "waveInMessage(%04X, %04X, %08lX, %08lX),FIXME!\n",
3504 hWaveIn, uMessage, dwParam1, dwParam2);
3505 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3506 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3509 fprintf(stderr,"waveInMessage16: cannot handle WIDM_OPEN, please report.\n");
3511 case WIDM_GETNUMDEVS:
3517 /* no argument conversion needed */
3519 case WIDM_GETDEVCAPS:
3520 return waveInGetDevCaps16(hWaveIn,(LPWAVEINCAPS16)PTR_SEG_TO_LIN(dwParam1),dwParam2);
3522 return waveInGetPosition16(hWaveIn,(LPMMTIME16)PTR_SEG_TO_LIN(dwParam1),dwParam2);
3524 return waveInPrepareHeader16(hWaveIn,(LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1),dwParam2);
3525 case WIDM_UNPREPARE:
3526 return waveInUnprepareHeader16(hWaveIn,(LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1),dwParam2);
3527 case WIDM_ADDBUFFER:
3528 return waveInAddBuffer16(hWaveIn,(LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1),dwParam2);
3530 fprintf(stderr,"unhandled waveInMessage16(%04x,%04x,%08lx,%08lx)\n",hWaveIn,uMessage,dwParam1,dwParam2);
3533 return widMessage(lpDesc->uDeviceID, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
3536 /**************************************************************************
3537 * mmioOpenW [WINMM.123]
3539 HMMIO32 WINAPI mmioOpen32W(LPWSTR szFileName, MMIOINFO32 * lpmmioinfo,
3542 LPSTR szFn = HEAP_strdupWtoA(GetProcessHeap(),0,szFileName);
3543 HMMIO32 ret = mmioOpen16(szFn,(LPMMIOINFO16)lpmmioinfo,dwOpenFlags);
3545 HeapFree(GetProcessHeap(),0,szFn);
3549 /**************************************************************************
3550 * mmioOpenA [WINMM.122]
3552 HMMIO32 WINAPI mmioOpen32A(LPSTR szFileName, MMIOINFO32 * lpmmioinfo,
3555 return mmioOpen16(szFileName,(LPMMIOINFO16)lpmmioinfo,dwOpenFlags);
3558 /**************************************************************************
3559 * mmioOpen [MMSYSTEM.1210]
3561 HMMIO16 WINAPI mmioOpen16(LPSTR szFileName, MMIOINFO16 * lpmmioinfo,
3567 LPMMIOINFO16 lpmminfo;
3568 dprintf_mmio(stddeb, "mmioOpen('%s', %p, %08lX);\n", szFileName, lpmmioinfo, dwOpenFlags);
3571 /* FIXME: should load memory file if szFileName == NULL */
3572 fprintf(stderr, "WARNING: mmioOpen(): szFileName == NULL (memory file ???)\n");
3575 hFile = OpenFile32(szFileName, &ofs, dwOpenFlags);
3576 if (hFile == -1) return 0;
3577 hmmio = GlobalAlloc16(GMEM_MOVEABLE, sizeof(MMIOINFO16));
3578 lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
3579 if (lpmminfo == NULL) return 0;
3580 memset(lpmminfo, 0, sizeof(MMIOINFO16));
3581 lpmminfo->hmmio = hmmio;
3582 lpmminfo->dwReserved2 = hFile;
3583 GlobalUnlock16(hmmio);
3584 dprintf_mmio(stddeb, "mmioOpen // return hmmio=%04X\n", hmmio);
3589 /**************************************************************************
3590 * mmioClose [MMSYSTEM.1211]
3592 UINT16 WINAPI mmioClose(HMMIO16 hmmio, UINT16 uFlags)
3594 LPMMIOINFO16 lpmminfo;
3595 dprintf_mmio(stddeb, "mmioClose(%04X, %04X);\n", hmmio, uFlags);
3596 lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
3597 if (lpmminfo == NULL) return 0;
3598 _lclose32((HFILE32)lpmminfo->dwReserved2);
3599 GlobalUnlock16(hmmio);
3600 GlobalFree16(hmmio);
3606 /**************************************************************************
3607 * mmioRead [MMSYSTEM.1212]
3609 LONG WINAPI mmioRead(HMMIO16 hmmio, HPSTR pch, LONG cch)
3612 LPMMIOINFO16 lpmminfo;
3613 dprintf_mmio(stddeb, "mmioRead(%04X, %p, %ld);\n", hmmio, pch, cch);
3614 lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
3615 if (lpmminfo == NULL) return 0;
3616 count = _lread32(LOWORD(lpmminfo->dwReserved2), pch, cch);
3617 GlobalUnlock16(hmmio);
3618 dprintf_mmio(stddeb, "mmioRead // count=%ld\n", count);
3624 /**************************************************************************
3625 * mmioWrite [MMSYSTEM.1213]
3627 LONG WINAPI mmioWrite(HMMIO16 hmmio, HPCSTR pch, LONG cch)
3630 LPMMIOINFO16 lpmminfo;
3631 dprintf_mmio(stddeb, "mmioWrite(%04X, %p, %ld);\n", hmmio, pch, cch);
3632 lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
3633 if (lpmminfo == NULL) return 0;
3634 count = _lwrite32(LOWORD(lpmminfo->dwReserved2), (LPSTR)pch, cch);
3635 GlobalUnlock16(hmmio);
3639 /**************************************************************************
3640 * mmioSeek [MMSYSTEM.1214]
3642 LONG WINAPI mmioSeek(HMMIO16 hmmio, LONG lOffset, int iOrigin)
3645 LPMMIOINFO16 lpmminfo;
3646 dprintf_mmio(stddeb, "mmioSeek(%04X, %08lX, %d);\n", hmmio, lOffset, iOrigin);
3647 lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
3648 if (lpmminfo == NULL) {
3649 dprintf_mmio(stddeb, "mmioSeek // can't lock hmmio=%04X !\n", hmmio);
3652 count = _llseek32((HFILE32)lpmminfo->dwReserved2, lOffset, iOrigin);
3653 GlobalUnlock16(hmmio);
3657 /**************************************************************************
3658 * mmioGetInfo [MMSYSTEM.1215]
3660 UINT16 WINAPI mmioGetInfo(HMMIO16 hmmio, MMIOINFO16 * lpmmioinfo, UINT16 uFlags)
3662 LPMMIOINFO16 lpmminfo;
3663 dprintf_mmio(stddeb, "mmioGetInfo\n");
3664 lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
3665 if (lpmminfo == NULL) return 0;
3666 memcpy(lpmmioinfo, lpmminfo, sizeof(MMIOINFO16));
3667 GlobalUnlock16(hmmio);
3671 /**************************************************************************
3672 * mmioSetInfo [MMSYSTEM.1216]
3674 UINT16 WINAPI mmioSetInfo(HMMIO16 hmmio, const MMIOINFO16 * lpmmioinfo, UINT16 uFlags)
3676 LPMMIOINFO16 lpmminfo;
3677 dprintf_mmio(stddeb, "mmioSetInfo\n");
3678 lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
3679 if (lpmminfo == NULL) return 0;
3680 GlobalUnlock16(hmmio);
3684 /**************************************************************************
3685 * mmioSetBuffer [MMSYSTEM.1217]
3687 UINT16 WINAPI mmioSetBuffer(HMMIO16 hmmio, LPSTR pchBuffer,
3688 LONG cchBuffer, UINT16 uFlags)
3690 dprintf_mmio(stddeb, "mmioSetBuffer // empty stub \n");
3694 /**************************************************************************
3695 * mmioFlush [MMSYSTEM.1218]
3697 UINT16 WINAPI mmioFlush(HMMIO16 hmmio, UINT16 uFlags)
3699 LPMMIOINFO16 lpmminfo;
3700 dprintf_mmio(stddeb, "mmioFlush(%04X, %04X)\n", hmmio, uFlags);
3701 lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
3702 if (lpmminfo == NULL) return 0;
3703 GlobalUnlock16(hmmio);
3707 /**************************************************************************
3708 * mmioAdvance [MMSYSTEM.1219]
3710 UINT16 WINAPI mmioAdvance(HMMIO16 hmmio, MMIOINFO16 * lpmmioinfo, UINT16 uFlags)
3713 LPMMIOINFO16 lpmminfo;
3714 dprintf_mmio(stddeb, "mmioAdvance\n");
3715 lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
3716 if (lpmminfo == NULL) return 0;
3717 if (uFlags == MMIO_READ) {
3718 count = _lread32(LOWORD(lpmminfo->dwReserved2),
3719 lpmmioinfo->pchBuffer, lpmmioinfo->cchBuffer);
3721 if (uFlags == MMIO_WRITE) {
3722 count = _lwrite32(LOWORD(lpmminfo->dwReserved2),
3723 lpmmioinfo->pchBuffer, lpmmioinfo->cchBuffer);
3725 lpmmioinfo->pchNext += count;
3726 GlobalUnlock16(hmmio);
3727 lpmminfo->lDiskOffset = _llseek32((HFILE32)lpmminfo->dwReserved2, 0, SEEK_CUR);
3731 /**************************************************************************
3732 * mmioStringToFOURCCW [WINMM.131]
3734 FOURCC WINAPI mmioStringToFOURCC32A(LPCSTR sz, UINT32 uFlags)
3736 return mmioStringToFOURCC16(sz,uFlags);
3739 /**************************************************************************
3740 * mmioStringToFOURCCW [WINMM.132]
3742 FOURCC WINAPI mmioStringToFOURCC32W(LPCWSTR sz, UINT32 uFlags)
3744 LPSTR szA = HEAP_strdupWtoA(GetProcessHeap(),0,sz);
3745 FOURCC ret = mmioStringToFOURCC32A(szA,uFlags);
3747 HeapFree(GetProcessHeap(),0,szA);
3751 /**************************************************************************
3752 * mmioStringToFOURCC [MMSYSTEM.1220]
3754 FOURCC WINAPI mmioStringToFOURCC16(LPCSTR sz, UINT16 uFlags)
3756 dprintf_mmio(stddeb, "mmioStringToFOURCC // empty stub \n");
3760 /**************************************************************************
3761 * mmioInstallIOProc16 [MMSYSTEM.1221]
3763 LPMMIOPROC16 WINAPI mmioInstallIOProc16(FOURCC fccIOProc,
3764 LPMMIOPROC16 pIOProc, DWORD dwFlags)
3766 dprintf_mmio(stddeb, "mmioInstallIOProc // empty stub \n");
3770 /**************************************************************************
3771 * mmioInstallIOProc32A [WINMM.120]
3773 LPMMIOPROC32 WINAPI mmioInstallIOProc32A(FOURCC fccIOProc,
3774 LPMMIOPROC32 pIOProc, DWORD dwFlags)
3776 dprintf_mmio(stddeb, "mmioInstallIOProcA (%c%c%c%c,%p,0x%08lx)// empty stub \n",
3777 (char)((fccIOProc&0xff000000)>>24),
3778 (char)((fccIOProc&0x00ff0000)>>16),
3779 (char)((fccIOProc&0x0000ff00)>> 8),
3780 (char)(fccIOProc&0x000000ff),
3785 /**************************************************************************
3786 * mmioSendMessage [MMSYSTEM.1222]
3788 LRESULT WINAPI mmioSendMessage(HMMIO16 hmmio, UINT16 uMessage,
3789 LPARAM lParam1, LPARAM lParam2)
3791 dprintf_mmio(stddeb, "mmioSendMessage // empty stub \n");
3795 /**************************************************************************
3796 * mmioDescend [MMSYSTEM.1223]
3798 UINT16 WINAPI mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck,
3799 const MMCKINFO * lpckParent, UINT16 uFlags)
3801 DWORD dwfcc, dwOldPos;
3803 dprintf_mmio(stddeb, "mmioDescend(%04X, %p, %p, %04X);\n",
3804 hmmio, lpck, lpckParent, uFlags);
3810 dprintf_mmio(stddeb, "mmioDescend // dwfcc=%08lX\n", dwfcc);
3812 dwOldPos = mmioSeek(hmmio, 0, SEEK_CUR);
3813 dprintf_mmio(stddeb, "mmioDescend // dwOldPos=%ld\n", dwOldPos);
3815 if (lpckParent != NULL) {
3816 dprintf_mmio(stddeb, "mmioDescend // seek inside parent at %ld !\n", lpckParent->dwDataOffset);
3817 dwOldPos = mmioSeek(hmmio, lpckParent->dwDataOffset, SEEK_SET);
3821 It seems to be that FINDRIFF should not be treated the same as the
3822 other FINDxxx so I treat it as a MMIO_FINDxxx
3824 if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDRIFF) ||
3825 (uFlags & MMIO_FINDLIST)) {
3827 if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDLIST)) {
3828 dprintf_mmio(stddeb, "mmioDescend // MMIO_FINDxxxx dwfcc=%08lX !\n", dwfcc);
3832 ix = mmioRead(hmmio, (LPSTR)lpck, sizeof(MMCKINFO));
3833 dprintf_mmio(stddeb, "mmioDescend // after _lread32 ix = %ld req = %d, errno = %d\n",ix,sizeof(MMCKINFO),errno);
3834 if (ix < sizeof(MMCKINFO)) {
3836 mmioSeek(hmmio, dwOldPos, SEEK_SET);
3837 dprintf_mmio(stddeb, "mmioDescend // return ChunkNotFound\n");
3838 return MMIOERR_CHUNKNOTFOUND;
3840 dprintf_mmio(stddeb, "mmioDescend // dwfcc=%08lX ckid=%08lX cksize=%08lX !\n",
3841 dwfcc, lpck->ckid, lpck->cksize);
3842 if (dwfcc == lpck->ckid)
3845 dwOldPos += lpck->cksize + 2 * sizeof(DWORD);
3846 if (lpck->ckid == FOURCC_RIFF || lpck->ckid == FOURCC_LIST)
3847 dwOldPos += sizeof(DWORD);
3848 mmioSeek(hmmio, dwOldPos, SEEK_SET);
3852 if (mmioRead(hmmio, (LPSTR)lpck, sizeof(MMCKINFO)) < sizeof(MMCKINFO)) {
3853 mmioSeek(hmmio, dwOldPos, SEEK_SET);
3854 dprintf_mmio(stddeb, "mmioDescend // return ChunkNotFound 2nd\n");
3855 return MMIOERR_CHUNKNOTFOUND;
3858 lpck->dwDataOffset = dwOldPos + 2 * sizeof(DWORD);
3859 if (lpck->ckid == FOURCC_RIFF || lpck->ckid == FOURCC_LIST)
3860 lpck->dwDataOffset += sizeof(DWORD);
3861 mmioSeek(hmmio, lpck->dwDataOffset, SEEK_SET);
3863 dprintf_mmio(stddeb, "mmioDescend // lpck->ckid=%08lX lpck->cksize=%ld !\n",
3864 lpck->ckid, lpck->cksize);
3865 dprintf_mmio(stddeb, "mmioDescend // lpck->fccType=%08lX !\n", lpck->fccType);
3870 /**************************************************************************
3871 * mmioAscend [MMSYSTEM.1224]
3873 UINT16 WINAPI mmioAscend(HMMIO16 hmmio, MMCKINFO * lpck, UINT16 uFlags)
3875 dprintf_mmio(stddeb, "mmioAscend // empty stub !\n");
3879 /**************************************************************************
3880 * mmioCreateChunk [MMSYSTEM.1225]
3882 UINT16 WINAPI mmioCreateChunk(HMMIO16 hmmio, MMCKINFO * lpck, UINT16 uFlags)
3884 dprintf_mmio(stddeb, "mmioCreateChunk // empty stub \n");
3889 /**************************************************************************
3890 * mmioRename [MMSYSTEM.1226]
3892 UINT16 WINAPI mmioRename(LPCSTR szFileName, LPCSTR szNewFileName,
3893 MMIOINFO16 * lpmmioinfo, DWORD dwRenameFlags)
3895 dprintf_mmio(stddeb, "mmioRename('%s', '%s', %p, %08lX); // empty stub \n",
3896 szFileName, szNewFileName, lpmmioinfo, dwRenameFlags);
3900 /**************************************************************************
3901 * DrvOpen [MMSYSTEM.1100]
3903 HDRVR16 WINAPI DrvOpen(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
3905 dprintf_mmsys(stddeb, "DrvOpen('%s', '%s', %08lX);\n",
3906 lpDriverName, lpSectionName, lParam);
3907 return OpenDriver(lpDriverName, lpSectionName, lParam);
3911 /**************************************************************************
3912 * DrvClose [MMSYSTEM.1101]
3914 LRESULT WINAPI DrvClose(HDRVR16 hDrvr, LPARAM lParam1, LPARAM lParam2)
3916 dprintf_mmsys(stddeb, "DrvClose(%04X, %08lX, %08lX);\n", hDrvr, lParam1, lParam2);
3917 return CloseDriver(hDrvr, lParam1, lParam2);
3921 /**************************************************************************
3922 * DrvSendMessage [MMSYSTEM.1102]
3924 LRESULT WINAPI DrvSendMessage(HDRVR16 hDriver, WORD msg, LPARAM lParam1,
3927 DWORD dwDriverID = 0;
3928 dprintf_mmsys(stddeb, "DrvSendMessage(%04X, %04X, %08lX, %08lX);\n",
3929 hDriver, msg, lParam1, lParam2);
3930 return CDAUDIO_DriverProc(dwDriverID, hDriver, msg, lParam1, lParam2);
3933 /**************************************************************************
3934 * DrvGetModuleHandle [MMSYSTEM.1103]
3936 HANDLE16 WINAPI DrvGetModuleHandle(HDRVR16 hDrvr)
3938 dprintf_mmsys(stddeb, "DrvGetModuleHandle(%04X);\n", hDrvr);
3943 /**************************************************************************
3944 * DrvDefDriverProc [MMSYSTEM.1104]
3946 LRESULT WINAPI DrvDefDriverProc(DWORD dwDriverID, HDRVR16 hDriv, WORD wMsg,
3947 DWORD dwParam1, DWORD dwParam2)
3949 return DefDriverProc(dwDriverID, hDriv, wMsg, dwParam1, dwParam2);