dsound: Cleanup the DirectSoundFullDuplex create functions.
This commit is contained in:
parent
0aeaa83a22
commit
885e205ade
|
@ -723,7 +723,7 @@ static IClassFactoryImpl DSOUND_CF[] = {
|
||||||
{ { &DSCF_Vtbl }, &CLSID_DirectSound8, DSOUND_Create8 },
|
{ { &DSCF_Vtbl }, &CLSID_DirectSound8, DSOUND_Create8 },
|
||||||
{ { &DSCF_Vtbl }, &CLSID_DirectSoundCapture, DSOUND_CaptureCreate },
|
{ { &DSCF_Vtbl }, &CLSID_DirectSoundCapture, DSOUND_CaptureCreate },
|
||||||
{ { &DSCF_Vtbl }, &CLSID_DirectSoundCapture8, DSOUND_CaptureCreate8 },
|
{ { &DSCF_Vtbl }, &CLSID_DirectSoundCapture8, DSOUND_CaptureCreate8 },
|
||||||
{ { &DSCF_Vtbl }, &CLSID_DirectSoundFullDuplex, (FnCreateInstance)DSOUND_FullDuplexCreate },
|
{ { &DSCF_Vtbl }, &CLSID_DirectSoundFullDuplex, DSOUND_FullDuplexCreate },
|
||||||
{ { &DSCF_Vtbl }, &CLSID_DirectSoundPrivate, (FnCreateInstance)IKsPrivatePropertySetImpl_Create },
|
{ { &DSCF_Vtbl }, &CLSID_DirectSoundPrivate, (FnCreateInstance)IKsPrivatePropertySetImpl_Create },
|
||||||
{ { NULL }, NULL, NULL }
|
{ { NULL }, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
|
@ -280,8 +280,8 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex)
|
||||||
LONG capped_refcount_dec(LONG *ref) DECLSPEC_HIDDEN;
|
LONG capped_refcount_dec(LONG *ref) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* duplex.c */
|
/* duplex.c */
|
||||||
|
|
||||||
HRESULT DSOUND_FullDuplexCreate(REFIID riid, LPDIRECTSOUNDFULLDUPLEX* ppDSFD) DECLSPEC_HIDDEN;
|
HRESULT DSOUND_FullDuplexCreate(REFIID riid, void **ppv) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* mixer.c */
|
/* mixer.c */
|
||||||
void DSOUND_CheckEvent(const IDirectSoundBufferImpl *dsb, DWORD playpos, int len) DECLSPEC_HIDDEN;
|
void DSOUND_CheckEvent(const IDirectSoundBufferImpl *dsb, DWORD playpos, int len) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -613,44 +613,29 @@ static const IDirectSoundFullDuplexVtbl dsfdvt =
|
||||||
IDirectSoundFullDuplexImpl_Initialize
|
IDirectSoundFullDuplexImpl_Initialize
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT DSOUND_FullDuplexCreate(
|
HRESULT DSOUND_FullDuplexCreate(REFIID riid, void **ppv)
|
||||||
REFIID riid,
|
|
||||||
LPDIRECTSOUNDFULLDUPLEX* ppDSFD)
|
|
||||||
{
|
{
|
||||||
IDirectSoundFullDuplexImpl *This = NULL;
|
IDirectSoundFullDuplexImpl *obj;
|
||||||
TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSFD);
|
HRESULT hr;
|
||||||
|
|
||||||
if (ppDSFD == NULL) {
|
TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
|
||||||
WARN("invalid parameter: ppDSFD == NULL\n");
|
|
||||||
return DSERR_INVALIDPARAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsEqualIID(riid, &IID_IUnknown) &&
|
*ppv = NULL;
|
||||||
!IsEqualIID(riid, &IID_IDirectSoundFullDuplex)) {
|
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj));
|
||||||
*ppDSFD = 0;
|
if (!obj) {
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get dsound configuration */
|
|
||||||
setup_dsound_options();
|
|
||||||
|
|
||||||
This = HeapAlloc(GetProcessHeap(),
|
|
||||||
HEAP_ZERO_MEMORY, sizeof(IDirectSoundFullDuplexImpl));
|
|
||||||
|
|
||||||
if (This == NULL) {
|
|
||||||
WARN("out of memory\n");
|
WARN("out of memory\n");
|
||||||
*ppDSFD = NULL;
|
|
||||||
return DSERR_OUTOFMEMORY;
|
return DSERR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
This->lpVtbl = &dsfdvt;
|
setup_dsound_options();
|
||||||
This->ref = 1;
|
|
||||||
This->capture_device = NULL;
|
|
||||||
This->renderer_device = NULL;
|
|
||||||
|
|
||||||
*ppDSFD = (LPDIRECTSOUNDFULLDUPLEX)This;
|
obj->lpVtbl = &dsfdvt;
|
||||||
|
obj->ref = 1;
|
||||||
|
|
||||||
return DS_OK;
|
hr = IUnknown_QueryInterface((IUnknown*)obj, riid, ppv);
|
||||||
|
IUnknown_Release((IUnknown*)obj);
|
||||||
|
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
@ -659,93 +644,50 @@ HRESULT DSOUND_FullDuplexCreate(
|
||||||
* Create and initialize a DirectSoundFullDuplex interface.
|
* Create and initialize a DirectSoundFullDuplex interface.
|
||||||
*
|
*
|
||||||
* PARAMS
|
* PARAMS
|
||||||
* pcGuidCaptureDevice [I] Address of sound capture device GUID.
|
* capture_dev [I] Address of sound capture device GUID.
|
||||||
* pcGuidRenderDevice [I] Address of sound render device GUID.
|
* render_dev [I] Address of sound render device GUID.
|
||||||
* pcDSCBufferDesc [I] Address of capture buffer description.
|
* cbufdesc [I] Address of capture buffer description.
|
||||||
* pcDSBufferDesc [I] Address of render buffer description.
|
* bufdesc [I] Address of render buffer description.
|
||||||
* hWnd [I] Handle to application window.
|
* hwnd [I] Handle to application window.
|
||||||
* dwLevel [I] Cooperative level.
|
* level [I] Cooperative level.
|
||||||
* ppDSFD [O] Address where full duplex interface returned.
|
* dsfd [O] Address where full duplex interface returned.
|
||||||
* ppDSCBuffer8 [0] Address where capture buffer interface returned.
|
* dscb8 [0] Address where capture buffer interface returned.
|
||||||
* ppDSBuffer8 [0] Address where render buffer interface returned.
|
* dsb8 [0] Address where render buffer interface returned.
|
||||||
* pUnkOuter [I] Must be NULL.
|
* outer_unk [I] Must be NULL.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Success: DS_OK
|
* Success: DS_OK
|
||||||
* Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
|
* Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
|
||||||
* DSERR_OUTOFMEMORY DSERR_INVALIDCALL DSERR_NODRIVER
|
* DSERR_OUTOFMEMORY DSERR_INVALIDCALL DSERR_NODRIVER
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI
|
HRESULT WINAPI DirectSoundFullDuplexCreate(const GUID *capture_dev, const GUID *render_dev,
|
||||||
DirectSoundFullDuplexCreate(
|
const DSCBUFFERDESC *cbufdesc, const DSBUFFERDESC *bufdesc, HWND hwnd, DWORD level,
|
||||||
LPCGUID pcGuidCaptureDevice,
|
IDirectSoundFullDuplex **dsfd, IDirectSoundCaptureBuffer8 **dscb8,
|
||||||
LPCGUID pcGuidRenderDevice,
|
IDirectSoundBuffer8 **dsb8, IUnknown *outer_unk)
|
||||||
LPCDSCBUFFERDESC pcDSCBufferDesc,
|
|
||||||
LPCDSBUFFERDESC pcDSBufferDesc,
|
|
||||||
HWND hWnd,
|
|
||||||
DWORD dwLevel,
|
|
||||||
LPDIRECTSOUNDFULLDUPLEX *ppDSFD,
|
|
||||||
LPDIRECTSOUNDCAPTUREBUFFER8 *ppDSCBuffer8,
|
|
||||||
LPDIRECTSOUNDBUFFER8 *ppDSBuffer8,
|
|
||||||
LPUNKNOWN pUnkOuter)
|
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hr;
|
||||||
IDirectSoundFullDuplexImpl *This = NULL;
|
|
||||||
TRACE("(%s,%s,%p,%p,%p,%x,%p,%p,%p,%p)\n",
|
|
||||||
debugstr_guid(pcGuidCaptureDevice), debugstr_guid(pcGuidRenderDevice),
|
|
||||||
pcDSCBufferDesc, pcDSBufferDesc, hWnd, dwLevel, ppDSFD, ppDSCBuffer8,
|
|
||||||
ppDSBuffer8, pUnkOuter);
|
|
||||||
|
|
||||||
if (pUnkOuter) {
|
TRACE("(%s,%s,%p,%p,%p,%x,%p,%p,%p,%p)\n", debugstr_guid(capture_dev),
|
||||||
WARN("pUnkOuter != 0\n");
|
debugstr_guid(render_dev), cbufdesc, bufdesc, hwnd, level, dsfd, dscb8, dsb8,
|
||||||
*ppDSFD = NULL;
|
outer_unk);
|
||||||
|
|
||||||
|
if (!dsfd)
|
||||||
|
return DSERR_INVALIDPARAM;
|
||||||
|
if (outer_unk) {
|
||||||
|
*dsfd = NULL;
|
||||||
return DSERR_NOAGGREGATION;
|
return DSERR_NOAGGREGATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcDSCBufferDesc == NULL) {
|
hr = DSOUND_FullDuplexCreate(&IID_IDirectSoundFullDuplex, (void**)dsfd);
|
||||||
WARN("invalid parameter: pcDSCBufferDesc == NULL\n");
|
if (hr == DS_OK) {
|
||||||
*ppDSFD = NULL;
|
hr = IDirectSoundFullDuplex_Initialize(*dsfd, capture_dev, render_dev, cbufdesc, bufdesc,
|
||||||
return DSERR_INVALIDPARAM;
|
hwnd, level, dscb8, dsb8);
|
||||||
|
if (hr != DS_OK) {
|
||||||
|
IDirectSoundFullDuplex_Release(*dsfd);
|
||||||
|
*dsfd = NULL;
|
||||||
|
WARN("IDirectSoundFullDuplexImpl_Initialize failed\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcDSBufferDesc == NULL) {
|
return hr;
|
||||||
WARN("invalid parameter: pcDSBufferDesc == NULL\n");
|
|
||||||
*ppDSFD = NULL;
|
|
||||||
return DSERR_INVALIDPARAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ppDSFD == NULL) {
|
|
||||||
WARN("invalid parameter: ppDSFD == NULL\n");
|
|
||||||
return DSERR_INVALIDPARAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ppDSCBuffer8 == NULL) {
|
|
||||||
WARN("invalid parameter: ppDSCBuffer8 == NULL\n");
|
|
||||||
*ppDSFD = NULL;
|
|
||||||
return DSERR_INVALIDPARAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ppDSBuffer8 == NULL) {
|
|
||||||
WARN("invalid parameter: ppDSBuffer8 == NULL\n");
|
|
||||||
*ppDSFD = NULL;
|
|
||||||
return DSERR_INVALIDPARAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
hres = DSOUND_FullDuplexCreate(&IID_IDirectSoundFullDuplex, (LPDIRECTSOUNDFULLDUPLEX*)&This);
|
|
||||||
if (FAILED(hres)) return hres;
|
|
||||||
|
|
||||||
hres = IDirectSoundFullDuplexImpl_Initialize((LPDIRECTSOUNDFULLDUPLEX)This,
|
|
||||||
pcGuidCaptureDevice,
|
|
||||||
pcGuidRenderDevice,
|
|
||||||
pcDSCBufferDesc,
|
|
||||||
pcDSBufferDesc,
|
|
||||||
hWnd, dwLevel, ppDSCBuffer8,
|
|
||||||
ppDSBuffer8);
|
|
||||||
if (hres != DS_OK) {
|
|
||||||
IUnknown_Release((LPDIRECTSOUNDFULLDUPLEX)This);
|
|
||||||
WARN("IDirectSoundFullDuplexImpl_Initialize failed\n");
|
|
||||||
*ppDSFD = NULL;
|
|
||||||
} else
|
|
||||||
*ppDSFD = (LPDIRECTSOUNDFULLDUPLEX)This;
|
|
||||||
|
|
||||||
return hres;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue