/* See file:///cdrom/sdk52/docs/worddoc/dsound.doc page 120 */ static HRESULT WINAPI PrimaryBufferImpl_SetFormat( LPDIRECTSOUNDBUFFER iface, LPCWAVEFORMATEX wfex) { DirectSoundDevice *device = ((PrimaryBufferImpl *)iface)->device; TRACE("(%p,%p)\n", iface, wfex); return DSOUND_PrimarySetFormat(device, wfex, device->priolevel == DSSCL_WRITEPRIMARY); }
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; IDirectSoundBufferImpl * dsb; TRACE("(%p,%s,%s,%p,%p,%lx,%lx,%p,%p)\n", This, debugstr_guid(pCaptureGuid), debugstr_guid(pRendererGuid), lpDscBufferDesc, lpDsBufferDesc, (DWORD)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 = DirectSoundDevice_Initialize(&This->renderer_device, pRendererGuid); if (hr != DS_OK) { WARN("DirectSoundDevice_Initialize() failed\n"); *lplpDirectSoundCaptureBuffer8 = NULL; *lplpDirectSoundBuffer8 = NULL; return hr; } if (dwLevel==DSSCL_PRIORITY || dwLevel==DSSCL_EXCLUSIVE) { WARN("level=%s not fully supported\n", dwLevel==DSSCL_PRIORITY ? "DSSCL_PRIORITY" : "DSSCL_EXCLUSIVE"); } This->renderer_device->priolevel = dwLevel; hr = DSOUND_PrimarySetFormat(This->renderer_device, lpDsBufferDesc->lpwfxFormat); if (hr != DS_OK) { WARN("DSOUND_PrimarySetFormat() failed\n"); *lplpDirectSoundCaptureBuffer8 = NULL; *lplpDirectSoundBuffer8 = NULL; return hr; } hr = IDirectSoundBufferImpl_Create(This->renderer_device, &dsb, lpDsBufferDesc); if (hr != DS_OK) { WARN("IDirectSoundBufferImpl_Create() failed\n"); *lplpDirectSoundCaptureBuffer8 = NULL; *lplpDirectSoundBuffer8 = NULL; return hr; } hr = SecondaryBufferImpl_Create(dsb, (SecondaryBufferImpl **)lplpDirectSoundBuffer8); if (hr != DS_OK) { WARN("SecondaryBufferImpl_Create() failed\n"); *lplpDirectSoundCaptureBuffer8 = NULL; *lplpDirectSoundBuffer8 = NULL; return hr; } IDirectSoundBuffer8_AddRef(*lplpDirectSoundBuffer8); hr = DirectSoundCaptureDevice_Initialize(&This->capture_device, pCaptureGuid); if (hr != DS_OK) { WARN("DirectSoundCaptureDevice_Initialize() failed\n"); *lplpDirectSoundCaptureBuffer8 = NULL; *lplpDirectSoundBuffer8 = NULL; return hr; } hr = IDirectSoundCaptureBufferImpl_Create(This->capture_device, (IDirectSoundCaptureBufferImpl **)lplpDirectSoundCaptureBuffer8, lpDscBufferDesc); if (hr != DS_OK) { WARN("IDirectSoundCaptureBufferImpl_Create() failed\n"); *lplpDirectSoundCaptureBuffer8 = NULL; *lplpDirectSoundBuffer8 = NULL; return hr; } return hr; }