/*************************************************************************** * DirectSoundCaptureCreate8 [DSOUND.12] * * Create and initialize a DirectSoundCapture interface. * * PARAMS * lpcGUID [I] Address of the GUID that identifies the sound capture device. * lplpDSC [O] Address of a variable to receive the interface pointer. * pUnkOuter [I] Must be NULL. * * RETURNS * Success: DS_OK * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM, * DSERR_OUTOFMEMORY * * NOTES * lpcGUID must be one of the values returned from DirectSoundCaptureEnumerate * or NULL for the default device or DSDEVID_DefaultCapture or * DSDEVID_DefaultVoiceCapture. * * DSERR_ALLOCATED is returned for sound devices that do not support full duplex. */ HRESULT WINAPI DirectSoundCaptureCreate8( LPCGUID lpcGUID, LPDIRECTSOUNDCAPTURE8 *ppDSC8, LPUNKNOWN pUnkOuter) { HRESULT hr; LPDIRECTSOUNDCAPTURE8 pDSC8; TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), ppDSC8, pUnkOuter); if (ppDSC8 == NULL) { WARN("invalid parameter: ppDSC8 == NULL\n"); return DSERR_INVALIDPARAM; } if (pUnkOuter) { WARN("invalid parameter: pUnkOuter != NULL\n"); *ppDSC8 = NULL; return DSERR_NOAGGREGATION; } hr = DSOUND_CaptureCreate8(&IID_IDirectSoundCapture8, (void**)&pDSC8); if (hr == DS_OK) { hr = IDirectSoundCapture_Initialize(pDSC8, lpcGUID); if (hr != DS_OK) { IDirectSoundCapture_Release(pDSC8); pDSC8 = 0; } } *ppDSC8 = pDSC8; return hr; }
static HRESULT WINAPI IDirectSoundFullDuplexImpl_Initialize( LPDIRECTSOUNDFULLDUPLEX iface, LPCGUID pCaptureGuid, LPCGUID pRendererGuid, LPCDSCBUFFERDESC lpDscBufferDesc, LPCDSBUFFERDESC lpDsBufferDesc, HWND hWnd, DWORD dwLevel, LPLPDIRECTSOUNDCAPTUREBUFFER8 lplpDirectSoundCaptureBuffer8, LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8 ) { HRESULT hr; IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; TRACE("(%p,%s,%s,%p,%p,%p,%x,%p,%p)\n", This, debugstr_guid(pCaptureGuid), debugstr_guid(pRendererGuid), lpDscBufferDesc, lpDsBufferDesc, hWnd, dwLevel, lplpDirectSoundCaptureBuffer8, lplpDirectSoundBuffer8); if (This->renderer_device != NULL || This->capture_device != NULL) { WARN("already initialized\n"); *lplpDirectSoundCaptureBuffer8 = NULL; *lplpDirectSoundBuffer8 = NULL; return DSERR_ALREADYINITIALIZED; } hr = DSOUND_Create8(&IID_IDirectSound8, &This->renderer_device); if (SUCCEEDED(hr)) hr = IDirectSound_Initialize(This->renderer_device, pRendererGuid); if (hr != DS_OK) { WARN("DirectSoundDevice_Initialize() failed\n"); *lplpDirectSoundCaptureBuffer8 = NULL; *lplpDirectSoundBuffer8 = NULL; return hr; } IDirectSound8_SetCooperativeLevel(This->renderer_device, hWnd, dwLevel); hr = IDirectSound8_CreateSoundBuffer(This->renderer_device, lpDsBufferDesc, (IDirectSoundBuffer**)lplpDirectSoundBuffer8, NULL); if (hr != DS_OK) { WARN("IDirectSoundBufferImpl_Create() failed\n"); *lplpDirectSoundCaptureBuffer8 = NULL; *lplpDirectSoundBuffer8 = NULL; return hr; } hr = DSOUND_CaptureCreate8(&IID_IDirectSoundCapture8, &This->capture_device); if (SUCCEEDED(hr)) hr = IDirectSoundCapture_Initialize(This->capture_device, pCaptureGuid); if (hr != DS_OK) { WARN("DirectSoundCaptureDevice_Initialize() failed\n"); *lplpDirectSoundCaptureBuffer8 = NULL; *lplpDirectSoundBuffer8 = NULL; return hr; } hr = IDirectSoundCapture_CreateCaptureBuffer(This->capture_device, lpDscBufferDesc, (IDirectSoundCaptureBuffer**)lplpDirectSoundCaptureBuffer8, NULL); if (hr != DS_OK) { WARN("IDirectSoundCaptureBufferImpl_Create() failed\n"); *lplpDirectSoundCaptureBuffer8 = NULL; *lplpDirectSoundBuffer8 = NULL; return hr; } return hr; }