Fixed forwarding and handling messages directed to the mappers.

This commit is contained in:
Eric Pouech 1999-11-21 00:51:05 +00:00 committed by Alexandre Julliard
parent 61206bd8a0
commit 31a1933aa5
3 changed files with 163 additions and 66 deletions

View File

@ -392,7 +392,7 @@ static MMDRV_MapType MMDRV_MidiOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPD
case MODM_CACHEPATCHES: case MODM_CACHEPATCHES:
case MODM_CACHEDRUMPATCHES: case MODM_CACHEDRUMPATCHES:
default: default:
FIXME("NIY: no conversion yet for %u\n", wMsg); FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2);
break; break;
} }
return ret; return ret;
@ -443,7 +443,7 @@ static MMDRV_MapType MMDRV_MidiOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPD
case MODM_CACHEPATCHES: case MODM_CACHEPATCHES:
case MODM_CACHEDRUMPATCHES: case MODM_CACHEDRUMPATCHES:
default: default:
FIXME("NIY: no conversion yet for %u\n", wMsg); FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2);
break; break;
} }
return ret; return ret;
@ -487,7 +487,7 @@ static MMDRV_MapType MMDRV_MidiOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
case MODM_CACHEPATCHES: case MODM_CACHEPATCHES:
case MODM_CACHEDRUMPATCHES: case MODM_CACHEDRUMPATCHES:
default: default:
FIXME("NIY: no conversion yet for %u\n", wMsg); FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2);
break; break;
} }
return ret; return ret;
@ -537,7 +537,7 @@ static MMDRV_MapType MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD
case MODM_CACHEPATCHES: case MODM_CACHEPATCHES:
case MODM_CACHEDRUMPATCHES: case MODM_CACHEDRUMPATCHES:
default: default:
FIXME("NIY: no conversion yet for %u\n", wMsg); FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2);
break; break;
} }
return ret; return ret;
@ -678,7 +678,8 @@ static MMDRV_MapType MMDRV_WaveIn_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPDW
} }
break; break;
default: default:
FIXME("NIY: no conversion yet for %u\n", wMsg); FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2);
FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2);
break; break;
} }
return ret; return ret;
@ -749,7 +750,7 @@ static MMDRV_MapType MMDRV_WaveIn_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDW
} }
break; break;
default: default:
FIXME("NIY: no conversion yet for %u\n", wMsg); FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2);
break; break;
} }
return ret; return ret;
@ -901,7 +902,7 @@ static MMDRV_MapType MMDRV_WaveIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPDW
} }
break; break;
default: default:
FIXME("NIY: no conversion yet for %u\n", wMsg); FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2);
break; break;
} }
return ret; return ret;
@ -993,7 +994,7 @@ static MMDRV_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDW
} }
break; break;
default: default:
FIXME("NIY: no conversion yet for %u\n", wMsg); FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2);
break; break;
} }
return ret; return ret;
@ -1145,7 +1146,7 @@ static MMDRV_MapType MMDRV_WaveOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPD
} }
break; break;
default: default:
FIXME("NIY: no conversion yet for %u\n", wMsg); FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2);
break; break;
} }
return ret; return ret;
@ -1227,7 +1228,7 @@ static MMDRV_MapType MMDRV_WaveOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPD
} }
break; break;
default: default:
FIXME("NIY: no conversion yet for %u\n", wMsg); FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2);
break; break;
} }
return ret; return ret;
@ -1764,7 +1765,7 @@ DWORD MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD dwParam1, DWORD dwFlags)
} }
} }
} else { } else {
mld->uDeviceID = (UINT16)0/*-1*/; mld->uDeviceID = (UINT16)-1;
mld->mmdIndex = llType->lpMlds[-1].mmdIndex; mld->mmdIndex = llType->lpMlds[-1].mmdIndex;
TRACE("Setting mmdIndex to %u\n", mld->mmdIndex); TRACE("Setting mmdIndex to %u\n", mld->mmdIndex);
dwRet = MMDRV_Message(mld, wMsg, dwParam1, dwFlags, TRUE); dwRet = MMDRV_Message(mld, wMsg, dwParam1, dwFlags, TRUE);
@ -1791,12 +1792,15 @@ DWORD MMDRV_Close(LPWINE_MLD mld, UINT wMsg)
} }
/************************************************************************** /**************************************************************************
* MMDRV_GetVByID [internal] * MMDRV_GetByID [internal]
*/ */
LPWINE_MLD MMDRV_GetByID(UINT uDevID, UINT type) LPWINE_MLD MMDRV_GetByID(UINT uDevID, UINT type)
{ {
return (uDevID < llTypes[type].wMaxId) ? if (uDevID < llTypes[type].wMaxId)
&llTypes[type].lpMlds[uDevID] : NULL; return &llTypes[type].lpMlds[uDevID];
if ((uDevID == (UINT16)-1 || uDevID == (UINT)-1) && llTypes[type].nMapper != -1)
return &llTypes[type].lpMlds[-1];
return NULL;
} }
/************************************************************************** /**************************************************************************
@ -1811,8 +1815,9 @@ LPWINE_MLD MMDRV_Get(HANDLE hndl, UINT type, BOOL bCanBeID)
if ((UINT)hndl >= llTypes[type].wMaxId) { if ((UINT)hndl >= llTypes[type].wMaxId) {
mld = (LPWINE_MLD)USER_HEAP_LIN_ADDR(hndl); mld = (LPWINE_MLD)USER_HEAP_LIN_ADDR(hndl);
if (mld && mld->type != type) mld = NULL; if (!IsBadWritePtr(mld, sizeof(*mld)) && mld->type != type) mld = NULL;
} else if (bCanBeID) { }
if (mld == NULL && bCanBeID) {
mld = MMDRV_GetByID((UINT)hndl, type); mld = MMDRV_GetByID((UINT)hndl, type);
} }
return mld; return mld;
@ -1846,23 +1851,23 @@ UINT MMDRV_PhysicalFeatures(LPWINE_MLD mld, UINT uMsg, DWORD dwParam1,
/* all those function calls are undocumented */ /* all those function calls are undocumented */
switch (uMsg) { switch (uMsg) {
case 0x801: case 0x801: /* DRV_QUERYDRVENTRY */
strncpy((LPSTR)dwParam1, lpDrv->name, LOWORD(dwParam2)); strncpy((LPSTR)dwParam1, lpDrv->name, LOWORD(dwParam2));
break; break;
case 0x802: case 0x802: /* DRV_QUERYDEVNODE */
*(LPDWORD)dwParam1 = 0L; /* should be DevNode */ *(LPDWORD)dwParam1 = 0L; /* should be DevNode */
break; break;
case 0x803: /* dont know */ case 0x803: /* DRV_QUERYNAME */
WARN("NIY 0x803\n"); WARN("NIY 0x803\n");
break; break;
case 0x804: case 0x804: /* DRV_QUERYDRIVERIDS */
WARN("NIY call VxD\n"); WARN("NIY call VxD\n");
/* should call VxD MMDEVLDR with (DevNode, dwParam1 and dwParam2) as pmts /* should call VxD MMDEVLDR with (DevNode, dwParam1 and dwParam2) as pmts
* dwParam1 is buffer and dwParam2 is sizeof buffer * dwParam1 is buffer and dwParam2 is sizeof buffer
* I don't know where the result is stored though * I don't know where the result is stored though
*/ */
break; break;
case 0x805: case 0x805: /* DRV_QUERYMAPPABLE */
return (lpDrv->bIsMapper) ? 2 : 0; return (lpDrv->bIsMapper) ? 2 : 0;
default: default:
WARN("Unknown call %04x\n", uMsg); WARN("Unknown call %04x\n", uMsg);
@ -1937,7 +1942,7 @@ static BOOL MMDRV_InitPerType(LPWINE_MM_DRIVER lpDrv, UINT num,
/* re-build the translation table */ /* re-build the translation table */
if (llTypes[type].nMapper != -1) { if (llTypes[type].nMapper != -1) {
TRACE("%s:Trans[%d] -> %s\n", llTypes[type].name, -1, MMDrvs[llTypes[type].nMapper].name); TRACE("%s:Trans[%d] -> %s\n", llTypes[type].name, -1, MMDrvs[llTypes[type].nMapper].name);
llTypes[type].lpMlds[-1].uDeviceID = -1; llTypes[type].lpMlds[-1].uDeviceID = (UINT16)-1;
llTypes[type].lpMlds[-1].type = type; llTypes[type].lpMlds[-1].type = type;
llTypes[type].lpMlds[-1].mmdIndex = llTypes[type].nMapper; llTypes[type].lpMlds[-1].mmdIndex = llTypes[type].nMapper;
llTypes[type].lpMlds[-1].dwDriverInstance = 0; llTypes[type].lpMlds[-1].dwDriverInstance = 0;

View File

@ -13,9 +13,15 @@
DEFAULT_DEBUG_CHANNEL(msacm) DEFAULT_DEBUG_CHANNEL(msacm)
typedef struct tagMIDIMAPDATA { typedef struct tagMIDIMAPDATA {
struct tagMIDIMAPDATA* self;
HMIDI hMidi; HMIDI hMidi;
} MIDIMAPDATA; } MIDIMAPDATA;
static BOOL MIDIMAP_IsData(MIDIMAPDATA* mm)
{
return (!IsBadReadPtr(mm, sizeof(MIDIMAPDATA)) && mm->self == mm);
}
/*======================================================================* /*======================================================================*
* MIDI OUT part * * MIDI OUT part *
*======================================================================*/ *======================================================================*/
@ -68,19 +74,41 @@ static DWORD modUnprepare(MIDIMAPDATA* mom, LPMIDIHDR lpMidiHdr, DWORD dwParam2)
return midiOutUnprepareHeader(mom->hMidi, lpMidiHdr, dwParam2); return midiOutUnprepareHeader(mom->hMidi, lpMidiHdr, dwParam2);
} }
static DWORD modGetDevCaps(MIDIMAPDATA* mom, LPMIDIOUTCAPSA lpMidiCaps, DWORD dwParam2) static DWORD modGetDevCaps(UINT wDevID, MIDIMAPDATA* mom, LPMIDIOUTCAPSA lpMidiCaps, DWORD dwParam2)
{ {
/* if opened low driver, forward message */
if (MIDIMAP_IsData(mom))
return midiOutGetDevCapsA(mom->hMidi, lpMidiCaps, dwParam2); return midiOutGetDevCapsA(mom->hMidi, lpMidiCaps, dwParam2);
/* otherwise, return caps of mapper itself */
if (wDevID == (UINT)-1 || wDevID == (UINT16)-1) {
lpMidiCaps->wMid = 0x00FF;
lpMidiCaps->wPid = 0x0001;
lpMidiCaps->vDriverVersion = 0x0100;
strcpy(lpMidiCaps->szPname, "Wine midi out mapper");
lpMidiCaps->wTechnology = MOD_MAPPER;
lpMidiCaps->wVoices = 0;
lpMidiCaps->wNotes = 0;
lpMidiCaps->wChannelMask = 0xFFFF;
lpMidiCaps->dwSupport = MIDICAPS_LRVOLUME | MIDICAPS_VOLUME;
return MMSYSERR_NOERROR;
}
ERR("This shouldn't happen\n");
return MMSYSERR_ERROR;
} }
static DWORD modGetVolume(MIDIMAPDATA* mom, LPDWORD lpVol) static DWORD modGetVolume(UINT wDevID, MIDIMAPDATA* mom, LPDWORD lpVol)
{ {
if (MIDIMAP_IsData(mom))
return midiOutGetVolume(mom->hMidi, lpVol); return midiOutGetVolume(mom->hMidi, lpVol);
return MMSYSERR_ERROR;
} }
static DWORD modSetVolume(MIDIMAPDATA* mom, DWORD vol) static DWORD modSetVolume(UINT wDevID, MIDIMAPDATA* mom, DWORD vol)
{ {
if (MIDIMAP_IsData(mom))
return midiOutSetVolume(mom->hMidi, vol); return midiOutSetVolume(mom->hMidi, vol);
return MMSYSERR_ERROR;
} }
static DWORD modReset(MIDIMAPDATA* mom) static DWORD modReset(MIDIMAPDATA* mom)
@ -113,10 +141,10 @@ DWORD WINAPI MIDIMAP_modMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case MODM_PREPARE: return modPrepare ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2); case MODM_PREPARE: return modPrepare ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2);
case MODM_UNPREPARE: return modUnprepare ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2); case MODM_UNPREPARE: return modUnprepare ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2);
case MODM_GETDEVCAPS: return modGetDevCaps ((MIDIMAPDATA*)dwUser, (LPMIDIOUTCAPSA)dwParam1,dwParam2); case MODM_GETDEVCAPS: return modGetDevCaps (wDevID, (MIDIMAPDATA*)dwUser, (LPMIDIOUTCAPSA)dwParam1,dwParam2);
case MODM_GETNUMDEVS: return 1; case MODM_GETNUMDEVS: return 1;
case MODM_GETVOLUME: return modGetVolume ((MIDIMAPDATA*)dwUser, (LPDWORD)dwParam1); case MODM_GETVOLUME: return modGetVolume (wDevID, (MIDIMAPDATA*)dwUser, (LPDWORD)dwParam1);
case MODM_SETVOLUME: return modSetVolume ((MIDIMAPDATA*)dwUser, dwParam1); case MODM_SETVOLUME: return modSetVolume (wDevID, (MIDIMAPDATA*)dwUser, dwParam1);
case MODM_RESET: return modReset ((MIDIMAPDATA*)dwUser); case MODM_RESET: return modReset ((MIDIMAPDATA*)dwUser);
default: default:
FIXME("unknown message %d!\n", wMsg); FIXME("unknown message %d!\n", wMsg);
@ -132,63 +160,77 @@ static DWORD midOpen(LPDWORD lpdwUser, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
{ {
UINT nd = midiInGetNumDevs(); UINT nd = midiInGetNumDevs();
UINT i; UINT i;
MIDIMAPDATA* wim = HeapAlloc(GetProcessHeap(), 0, sizeof(MIDIMAPDATA)); MIDIMAPDATA* mim = HeapAlloc(GetProcessHeap(), 0, sizeof(MIDIMAPDATA));
TRACE("(%p %p %08lx\n", lpdwUser, lpDesc, dwFlags); TRACE("(%p %p %08lx\n", lpdwUser, lpDesc, dwFlags);
for (i = 0; i < nd; i++) { for (i = 0; i < nd; i++) {
if (midiInOpen(&wim->hMidi, i, lpDesc->dwCallback, if (midiInOpen(&mim->hMidi, i, lpDesc->dwCallback,
lpDesc->dwInstance, dwFlags) == MMSYSERR_NOERROR) { lpDesc->dwInstance, dwFlags) == MMSYSERR_NOERROR) {
lpDesc->hMidi = wim->hMidi; lpDesc->hMidi = mim->hMidi;
*lpdwUser = (DWORD)wim; *lpdwUser = (DWORD)mim;
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
} }
} }
HeapFree(GetProcessHeap(), 0, wim); HeapFree(GetProcessHeap(), 0, mim);
return MMSYSERR_ALLOCATED; return MMSYSERR_ALLOCATED;
} }
static DWORD midClose(MIDIMAPDATA* wim) static DWORD midClose(MIDIMAPDATA* mim)
{ {
DWORD ret = midiInClose(wim->hMidi); DWORD ret = midiInClose(mim->hMidi);
if (ret == MMSYSERR_NOERROR) if (ret == MMSYSERR_NOERROR)
HeapFree(GetProcessHeap(), 0, wim); HeapFree(GetProcessHeap(), 0, mim);
return ret; return ret;
} }
static DWORD midAddBuffer(MIDIMAPDATA* wim, LPMIDIHDR lpMidiHdr, DWORD dwParam2) static DWORD midAddBuffer(MIDIMAPDATA* mim, LPMIDIHDR lpMidiHdr, DWORD dwParam2)
{ {
return midiInAddBuffer(wim->hMidi, lpMidiHdr, dwParam2); return midiInAddBuffer(mim->hMidi, lpMidiHdr, dwParam2);
} }
static DWORD midPrepare(MIDIMAPDATA* wim, LPMIDIHDR lpMidiHdr, DWORD dwParam2) static DWORD midPrepare(MIDIMAPDATA* mim, LPMIDIHDR lpMidiHdr, DWORD dwParam2)
{ {
return midiInPrepareHeader(wim->hMidi, lpMidiHdr, dwParam2); return midiInPrepareHeader(mim->hMidi, lpMidiHdr, dwParam2);
} }
static DWORD midUnprepare(MIDIMAPDATA* wim, LPMIDIHDR lpMidiHdr, DWORD dwParam2) static DWORD midUnprepare(MIDIMAPDATA* mim, LPMIDIHDR lpMidiHdr, DWORD dwParam2)
{ {
return midiInUnprepareHeader(wim->hMidi, lpMidiHdr, dwParam2); return midiInUnprepareHeader(mim->hMidi, lpMidiHdr, dwParam2);
} }
static DWORD midGetDevCaps(MIDIMAPDATA* wim, LPMIDIINCAPSA lpMidiCaps, DWORD dwParam2) static DWORD midGetDevCaps(UINT wDevID, MIDIMAPDATA* mim, LPMIDIINCAPSA lpMidiCaps, DWORD dwParam2)
{ {
return midiInGetDevCapsA(wim->hMidi, lpMidiCaps, dwParam2); /* if opened low driver, forward message */
if (MIDIMAP_IsData(mim))
return midiInGetDevCapsA(mim->hMidi, lpMidiCaps, dwParam2);
/* otherwise, return caps of mapper itself */
if (wDevID == (UINT)-1 || wDevID == (UINT16)-1) {
lpMidiCaps->wMid = 0x00FF;
lpMidiCaps->wPid = 0x0001;
lpMidiCaps->vDriverVersion = 0x0100;
strcpy(lpMidiCaps->szPname, "Wine midi int mapper");
lpMidiCaps->dwSupport = 0;
return MMSYSERR_NOERROR;
}
ERR("This shouldn't happen\n");
return MMSYSERR_ERROR;
} }
static DWORD midStop(MIDIMAPDATA* wim) static DWORD midStop(MIDIMAPDATA* mim)
{ {
return midiInStop(wim->hMidi); return midiInStop(mim->hMidi);
} }
static DWORD midStart(MIDIMAPDATA* wim) static DWORD midStart(MIDIMAPDATA* mim)
{ {
return midiInStart(wim->hMidi); return midiInStart(mim->hMidi);
} }
static DWORD midReset(MIDIMAPDATA* wim) static DWORD midReset(MIDIMAPDATA* mim)
{ {
return midiInReset(wim->hMidi); return midiInReset(mim->hMidi);
} }
/************************************************************************** /**************************************************************************
@ -214,7 +256,7 @@ DWORD WINAPI MIDIMAP_midMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
case MIDM_ADDBUFFER: return midAddBuffer ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2); case MIDM_ADDBUFFER: return midAddBuffer ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2);
case MIDM_PREPARE: return midPrepare ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2); case MIDM_PREPARE: return midPrepare ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2);
case MIDM_UNPREPARE: return midUnprepare ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2); case MIDM_UNPREPARE: return midUnprepare ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2);
case MIDM_GETDEVCAPS: return midGetDevCaps ((MIDIMAPDATA*)dwUser, (LPMIDIINCAPSA)dwParam1, dwParam2); case MIDM_GETDEVCAPS: return midGetDevCaps (wDevID, (MIDIMAPDATA*)dwUser, (LPMIDIINCAPSA)dwParam1, dwParam2);
case MIDM_GETNUMDEVS: return 1; case MIDM_GETNUMDEVS: return 1;
case MIDM_RESET: return midReset ((MIDIMAPDATA*)dwUser); case MIDM_RESET: return midReset ((MIDIMAPDATA*)dwUser);
case MIDM_START: return midStart ((MIDIMAPDATA*)dwUser); case MIDM_START: return midStart ((MIDIMAPDATA*)dwUser);

View File

@ -20,6 +20,7 @@
DEFAULT_DEBUG_CHANNEL(msacm) DEFAULT_DEBUG_CHANNEL(msacm)
typedef struct tagWAVEMAPDATA { typedef struct tagWAVEMAPDATA {
struct tagWAVEMAPDATA* self;
HWAVE hWave; HWAVE hWave;
HACMSTREAM hAcmStream; HACMSTREAM hAcmStream;
/* needed data to filter callbacks. Only needed when hAcmStream is not 0 */ /* needed data to filter callbacks. Only needed when hAcmStream is not 0 */
@ -34,6 +35,11 @@ typedef struct tagWAVEMAPDATA {
MMRESULT (WINAPI *acmStreamUnprepareHeader)(HACMSTREAM, PACMSTREAMHEADER, DWORD); MMRESULT (WINAPI *acmStreamUnprepareHeader)(HACMSTREAM, PACMSTREAMHEADER, DWORD);
} WAVEMAPDATA; } WAVEMAPDATA;
static BOOL WAVEMAP_IsData(WAVEMAPDATA* wm)
{
return (!IsBadReadPtr(wm, sizeof(WAVEMAPDATA)) && wm->self == wm);
}
/*======================================================================* /*======================================================================*
* WAVE OUT part * * WAVE OUT part *
*======================================================================*/ *======================================================================*/
@ -97,6 +103,8 @@ static DWORD wodOpen(LPDWORD lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
if (!wom) if (!wom)
return MMSYSERR_NOMEM; return MMSYSERR_NOMEM;
wom->self = wom;
for (i = 0; i < nd; i++) { for (i = 0; i < nd; i++) {
/* if no ACM stuff is involved, no need to handle callbacks at this /* if no ACM stuff is involved, no need to handle callbacks at this
* level, this will be done transparently * level, this will be done transparently
@ -265,19 +273,42 @@ static DWORD wodGetPosition(WAVEMAPDATA* wom, LPMMTIME lpTime, DWORD dwParam2)
return waveOutGetPosition(wom->hWave, lpTime, dwParam2); return waveOutGetPosition(wom->hWave, lpTime, dwParam2);
} }
static DWORD wodGetDevCaps(WAVEMAPDATA* wom, LPWAVEOUTCAPSA lpWaveCaps, DWORD dwParam2) static DWORD wodGetDevCaps(UINT wDevID, WAVEMAPDATA* wom, LPWAVEOUTCAPSA lpWaveCaps, DWORD dwParam2)
{ {
/* if opened low driver, forward message */
if (WAVEMAP_IsData(wom))
return waveOutGetDevCapsA(wom->hWave, lpWaveCaps, dwParam2); return waveOutGetDevCapsA(wom->hWave, lpWaveCaps, dwParam2);
/* otherwise, return caps of mapper itself */
if (wDevID == (UINT)-1 || wDevID == (UINT16)-1) {
lpWaveCaps->wMid = 0x00FF;
lpWaveCaps->wPid = 0x0001;
lpWaveCaps->vDriverVersion = 0x0100;
strcpy(lpWaveCaps->szPname, "Wine wave out mapper");
lpWaveCaps->dwFormats =
WAVE_FORMAT_4M08 | WAVE_FORMAT_4S08 | WAVE_FORMAT_4M16 | WAVE_FORMAT_4S16 |
WAVE_FORMAT_2M08 | WAVE_FORMAT_2S08 | WAVE_FORMAT_2M16 | WAVE_FORMAT_2S16 |
WAVE_FORMAT_1M08 | WAVE_FORMAT_1S08 | WAVE_FORMAT_1M16 | WAVE_FORMAT_1S16;
lpWaveCaps->wChannels = 2;
lpWaveCaps->dwSupport = WAVECAPS_VOLUME | WAVECAPS_LRVOLUME;
return MMSYSERR_NOERROR;
}
ERR("This shouldn't happen\n");
return MMSYSERR_ERROR;
} }
static DWORD wodGetVolume(WAVEMAPDATA* wom, LPDWORD lpVol) static DWORD wodGetVolume(UINT wDevID, WAVEMAPDATA* wom, LPDWORD lpVol)
{ {
if (WAVEMAP_IsData(wom))
return waveOutGetVolume(wom->hWave, lpVol); return waveOutGetVolume(wom->hWave, lpVol);
return MMSYSERR_NOERROR;
} }
static DWORD wodSetVolume(WAVEMAPDATA* wom, DWORD vol) static DWORD wodSetVolume(UINT wDevID, WAVEMAPDATA* wom, DWORD vol)
{ {
if (WAVEMAP_IsData(wom))
return waveOutSetVolume(wom->hWave, vol); return waveOutSetVolume(wom->hWave, vol);
return MMSYSERR_NOERROR;
} }
static DWORD wodPause(WAVEMAPDATA* wom) static DWORD wodPause(WAVEMAPDATA* wom)
@ -319,14 +350,14 @@ DWORD WINAPI WAVEMAP_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
case WODM_BREAKLOOP: return MMSYSERR_NOTSUPPORTED; case WODM_BREAKLOOP: return MMSYSERR_NOTSUPPORTED;
case WODM_PREPARE: return wodPrepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2); case WODM_PREPARE: return wodPrepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_UNPREPARE: return wodUnprepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2); case WODM_UNPREPARE: return wodUnprepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_GETDEVCAPS: return wodGetDevCaps ((WAVEMAPDATA*)dwUser, (LPWAVEOUTCAPSA)dwParam1,dwParam2); case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (WAVEMAPDATA*)dwUser, (LPWAVEOUTCAPSA)dwParam1,dwParam2);
case WODM_GETNUMDEVS: return 1; case WODM_GETNUMDEVS: return 1;
case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED; case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED;
case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED; case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED;
case WODM_GETPLAYBACKRATE: return MMSYSERR_NOTSUPPORTED; case WODM_GETPLAYBACKRATE: return MMSYSERR_NOTSUPPORTED;
case WODM_SETPLAYBACKRATE: return MMSYSERR_NOTSUPPORTED; case WODM_SETPLAYBACKRATE: return MMSYSERR_NOTSUPPORTED;
case WODM_GETVOLUME: return wodGetVolume ((WAVEMAPDATA*)dwUser, (LPDWORD)dwParam1); case WODM_GETVOLUME: return wodGetVolume (wDevID, (WAVEMAPDATA*)dwUser, (LPDWORD)dwParam1);
case WODM_SETVOLUME: return wodSetVolume ((WAVEMAPDATA*)dwUser, dwParam1); case WODM_SETVOLUME: return wodSetVolume (wDevID, (WAVEMAPDATA*)dwUser, dwParam1);
case WODM_RESTART: return wodRestart ((WAVEMAPDATA*)dwUser); case WODM_RESTART: return wodRestart ((WAVEMAPDATA*)dwUser);
case WODM_RESET: return wodReset ((WAVEMAPDATA*)dwUser); case WODM_RESET: return wodReset ((WAVEMAPDATA*)dwUser);
default: default:
@ -347,6 +378,8 @@ static DWORD widOpen(LPDWORD lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
TRACE("(%p %p %08lx\n", lpdwUser, lpDesc, dwFlags); TRACE("(%p %p %08lx\n", lpdwUser, lpDesc, dwFlags);
wim->self = wim;
for (i = 0; i < nd; i++) { for (i = 0; i < nd; i++) {
if (waveInOpen(&wim->hWave, i, lpDesc->lpFormat, lpDesc->dwCallback, if (waveInOpen(&wim->hWave, i, lpDesc->lpFormat, lpDesc->dwCallback,
lpDesc->dwInstance, dwFlags) == MMSYSERR_NOERROR) { lpDesc->dwInstance, dwFlags) == MMSYSERR_NOERROR) {
@ -387,9 +420,26 @@ static DWORD widGetPosition(WAVEMAPDATA* wim, LPMMTIME lpTime, DWORD dwParam2)
return waveInGetPosition(wim->hWave, lpTime, dwParam2); return waveInGetPosition(wim->hWave, lpTime, dwParam2);
} }
static DWORD widGetDevCaps(WAVEMAPDATA* wim, LPWAVEINCAPSA lpWaveCaps, DWORD dwParam2) static DWORD widGetDevCaps(UINT wDevID, WAVEMAPDATA* wim, LPWAVEINCAPSA lpWaveCaps, DWORD dwParam2)
{ {
/* if opened low driver, forward message */
if (WAVEMAP_IsData(wim))
return waveInGetDevCapsA(wim->hWave, lpWaveCaps, dwParam2); return waveInGetDevCapsA(wim->hWave, lpWaveCaps, dwParam2);
/* otherwise, return caps of mapper itself */
if (wDevID == (UINT)-1 || wDevID == (UINT16)-1) {
lpWaveCaps->wMid = 0x00FF;
lpWaveCaps->wPid = 0x0001;
lpWaveCaps->vDriverVersion = 0x0001;
strcpy(lpWaveCaps->szPname, "Wine wave in mapper");
lpWaveCaps->dwFormats =
WAVE_FORMAT_4M08 | WAVE_FORMAT_4S08 | WAVE_FORMAT_4M16 | WAVE_FORMAT_4S16 |
WAVE_FORMAT_2M08 | WAVE_FORMAT_2S08 | WAVE_FORMAT_2M16 | WAVE_FORMAT_2S16 |
WAVE_FORMAT_1M08 | WAVE_FORMAT_1S08 | WAVE_FORMAT_1M16 | WAVE_FORMAT_1S16;
lpWaveCaps->wChannels = 2;
return MMSYSERR_NOERROR;
}
ERR("This shouldn't happen\n");
return MMSYSERR_ERROR;
} }
static DWORD widStop(WAVEMAPDATA* wim) static DWORD widStop(WAVEMAPDATA* wim)
@ -430,7 +480,7 @@ DWORD WINAPI WAVEMAP_widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
case WIDM_ADDBUFFER: return widAddBuffer ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2); case WIDM_ADDBUFFER: return widAddBuffer ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_PREPARE: return widPrepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2); case WIDM_PREPARE: return widPrepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_UNPREPARE: return widUnprepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2); case WIDM_UNPREPARE: return widUnprepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_GETDEVCAPS: return widGetDevCaps ((WAVEMAPDATA*)dwUser, (LPWAVEINCAPSA)dwParam1, dwParam2); case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (WAVEMAPDATA*)dwUser, (LPWAVEINCAPSA)dwParam1, dwParam2);
case WIDM_GETNUMDEVS: return 1; case WIDM_GETNUMDEVS: return 1;
case WIDM_GETPOS: return widGetPosition ((WAVEMAPDATA*)dwUser, (LPMMTIME)dwParam1, dwParam2); case WIDM_GETPOS: return widGetPosition ((WAVEMAPDATA*)dwUser, (LPMMTIME)dwParam1, dwParam2);
case WIDM_RESET: return widReset ((WAVEMAPDATA*)dwUser); case WIDM_RESET: return widReset ((WAVEMAPDATA*)dwUser);