dsound: Implement DirectSoundCaptureEnumerateA on top of DirectSoundCaptureEnumerateW.

This commit is contained in:
Maarten Lankhorst 2009-11-14 14:30:49 +01:00 committed by Alexandre Julliard
parent 03c16aaba9
commit 708eaaa6be
1 changed files with 6 additions and 36 deletions

View File

@ -400,51 +400,21 @@ HRESULT WINAPI DirectSoundEnumerateW(
* Success: DS_OK * Success: DS_OK
* Failure: DSERR_INVALIDPARAM * Failure: DSERR_INVALIDPARAM
*/ */
HRESULT WINAPI HRESULT WINAPI DirectSoundCaptureEnumerateA(
DirectSoundCaptureEnumerateA(
LPDSENUMCALLBACKA lpDSEnumCallback, LPDSENUMCALLBACKA lpDSEnumCallback,
LPVOID lpContext) LPVOID lpContext)
{ {
unsigned devs, wid; struct morecontext context;
DSDRIVERDESC desc;
GUID guid;
int err;
TRACE("(%p,%p)\n", lpDSEnumCallback, lpContext );
if (lpDSEnumCallback == NULL) { if (lpDSEnumCallback == NULL) {
WARN("invalid parameter: lpDSEnumCallback == NULL\n"); WARN("invalid parameter: lpDSEnumCallback == NULL\n");
return DSERR_INVALIDPARAM; return DSERR_INVALIDPARAM;
} }
devs = waveInGetNumDevs(); context.callA = lpDSEnumCallback;
if (devs > 0) { context.data = lpContext;
if (GetDeviceID(&DSDEVID_DefaultCapture, &guid) == DS_OK) {
for (wid = 0; wid < devs; ++wid) {
if (IsEqualGUID( &guid, &DSOUND_capture_guids[wid] ) ) {
err = mmErr(waveInMessage(UlongToHandle(wid),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
if (err == DS_OK) {
TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
"Primary Sound Capture Driver",desc.szDrvname,lpContext);
if (lpDSEnumCallback(NULL, "Primary Sound Capture Driver", desc.szDrvname, lpContext) == FALSE)
return DS_OK;
}
}
}
}
}
for (wid = 0; wid < devs; ++wid) { return DirectSoundCaptureEnumerateW(a_to_w_callback, &context);
err = mmErr(waveInMessage(UlongToHandle(wid),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
if (err == DS_OK) {
TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
debugstr_guid(&DSOUND_capture_guids[wid]),desc.szDesc,desc.szDrvname,lpContext);
if (lpDSEnumCallback(&DSOUND_capture_guids[wid], desc.szDesc, desc.szDrvname, lpContext) == FALSE)
return DS_OK;
}
}
return DS_OK;
} }
/*************************************************************************** /***************************************************************************