mirror of
https://github.com/reactos/wine.git
synced 2025-02-08 05:08:16 +00:00
dsound: Merge the DirectSound create functions.
This commit is contained in:
parent
8978a4b51b
commit
bf4481d3f0
@ -583,9 +583,12 @@ static HRESULT IDirectSound8_IDirectSound8_Create(
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
static HRESULT IDirectSoundImpl_Create(void **ppv, BOOL has_ds8)
|
||||
static HRESULT IDirectSoundImpl_Create(REFIID riid, void **ppv, BOOL has_ds8)
|
||||
{
|
||||
IDirectSoundImpl *obj;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
|
||||
|
||||
*ppv = NULL;
|
||||
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj));
|
||||
@ -594,50 +597,30 @@ static HRESULT IDirectSoundImpl_Create(void **ppv, BOOL has_ds8)
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
setup_dsound_options();
|
||||
|
||||
obj->IUnknown_iface.lpVtbl = &unk_vtbl;
|
||||
obj->ref = 0;
|
||||
obj->numIfaces = 0;
|
||||
obj->ref = 1;
|
||||
obj->numIfaces = 1;
|
||||
obj->device = NULL;
|
||||
obj->has_ds8 = has_ds8;
|
||||
|
||||
*ppv = obj;
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
HRESULT DSOUND_Create(
|
||||
REFIID riid,
|
||||
LPDIRECTSOUND *ppDS)
|
||||
{
|
||||
LPDIRECTSOUND8 pDS;
|
||||
HRESULT hr;
|
||||
TRACE("(%s, %p)\n", debugstr_guid(riid), ppDS);
|
||||
|
||||
if (!IsEqualIID(riid, &IID_IUnknown) &&
|
||||
!IsEqualIID(riid, &IID_IDirectSound)) {
|
||||
*ppDS = 0;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/* Get dsound configuration */
|
||||
setup_dsound_options();
|
||||
|
||||
hr = IDirectSoundImpl_Create((void **)&pDS, FALSE);
|
||||
if (hr == DS_OK) {
|
||||
hr = IDirectSound_IDirectSound_Create(pDS, ppDS);
|
||||
if (*ppDS)
|
||||
IDirectSound_IDirectSound_AddRef(*ppDS);
|
||||
else {
|
||||
WARN("IDirectSound_IDirectSound_Create failed\n");
|
||||
IDirectSound8_Release(pDS);
|
||||
}
|
||||
} else {
|
||||
WARN("IDirectSoundImpl_Create failed\n");
|
||||
*ppDS = 0;
|
||||
}
|
||||
hr = IUnknown_QueryInterface(&obj->IUnknown_iface, riid, ppv);
|
||||
IUnknown_Release(&obj->IUnknown_iface);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT DSOUND_Create(REFIID riid, void **ppv)
|
||||
{
|
||||
return IDirectSoundImpl_Create(riid, ppv, FALSE);
|
||||
}
|
||||
|
||||
HRESULT DSOUND_Create8(REFIID riid, void **ppv)
|
||||
{
|
||||
return IDirectSoundImpl_Create(riid, ppv, TRUE);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* DirectSoundCreate (DSOUND.1)
|
||||
*
|
||||
@ -674,7 +657,7 @@ HRESULT WINAPI DirectSoundCreate(
|
||||
return DSERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
hr = DSOUND_Create(&IID_IDirectSound, &pDS);
|
||||
hr = DSOUND_Create(&IID_IDirectSound, (void **)&pDS);
|
||||
if (hr == DS_OK) {
|
||||
hr = IDirectSound_Initialize(pDS, lpcGUID);
|
||||
if (hr != DS_OK) {
|
||||
@ -691,41 +674,6 @@ HRESULT WINAPI DirectSoundCreate(
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT DSOUND_Create8(
|
||||
REFIID riid,
|
||||
LPDIRECTSOUND8 *ppDS)
|
||||
{
|
||||
LPDIRECTSOUND8 pDS;
|
||||
HRESULT hr;
|
||||
TRACE("(%s, %p)\n", debugstr_guid(riid), ppDS);
|
||||
|
||||
if (!IsEqualIID(riid, &IID_IUnknown) &&
|
||||
!IsEqualIID(riid, &IID_IDirectSound) &&
|
||||
!IsEqualIID(riid, &IID_IDirectSound8)) {
|
||||
*ppDS = 0;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/* Get dsound configuration */
|
||||
setup_dsound_options();
|
||||
|
||||
hr = IDirectSoundImpl_Create((void **)&pDS, TRUE);
|
||||
if (hr == DS_OK) {
|
||||
hr = IDirectSound8_IDirectSound8_Create(pDS, ppDS);
|
||||
if (*ppDS)
|
||||
IDirectSound8_IDirectSound8_AddRef(*ppDS);
|
||||
else {
|
||||
WARN("IDirectSound8_IDirectSound8_Create failed\n");
|
||||
IDirectSound8_Release(pDS);
|
||||
}
|
||||
} else {
|
||||
WARN("IDirectSoundImpl_Create failed\n");
|
||||
*ppDS = 0;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* DirectSoundCreate8 (DSOUND.11)
|
||||
*
|
||||
@ -762,7 +710,7 @@ HRESULT WINAPI DirectSoundCreate8(
|
||||
return DSERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
hr = DSOUND_Create8(&IID_IDirectSound8, &pDS);
|
||||
hr = DSOUND_Create8(&IID_IDirectSound8, (void **)&pDS);
|
||||
if (hr == DS_OK) {
|
||||
hr = IDirectSound8_Initialize(pDS, lpcGUID);
|
||||
if (hr != DS_OK) {
|
||||
|
@ -719,8 +719,8 @@ static const IClassFactoryVtbl DSCF_Vtbl = {
|
||||
};
|
||||
|
||||
static IClassFactoryImpl DSOUND_CF[] = {
|
||||
{ { &DSCF_Vtbl }, &CLSID_DirectSound, (FnCreateInstance)DSOUND_Create },
|
||||
{ { &DSCF_Vtbl }, &CLSID_DirectSound8, (FnCreateInstance)DSOUND_Create8 },
|
||||
{ { &DSCF_Vtbl }, &CLSID_DirectSound, DSOUND_Create },
|
||||
{ { &DSCF_Vtbl }, &CLSID_DirectSound8, DSOUND_Create8 },
|
||||
{ { &DSCF_Vtbl }, &CLSID_DirectSoundCapture, (FnCreateInstance)DSOUND_CaptureCreate },
|
||||
{ { &DSCF_Vtbl }, &CLSID_DirectSoundCapture8, (FnCreateInstance)DSOUND_CaptureCreate8 },
|
||||
{ { &DSCF_Vtbl }, &CLSID_DirectSoundFullDuplex, (FnCreateInstance)DSOUND_FullDuplexCreate },
|
||||
|
@ -264,8 +264,8 @@ HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, IKsPropertySet **piks) DEC
|
||||
|
||||
/* dsound.c */
|
||||
|
||||
HRESULT DSOUND_Create(REFIID riid, LPDIRECTSOUND *ppDS) DECLSPEC_HIDDEN;
|
||||
HRESULT DSOUND_Create8(REFIID riid, LPDIRECTSOUND8 *ppDS) DECLSPEC_HIDDEN;
|
||||
HRESULT DSOUND_Create(REFIID riid, void **ppv) DECLSPEC_HIDDEN;
|
||||
HRESULT DSOUND_Create8(REFIID riid, void **ppv) DECLSPEC_HIDDEN;
|
||||
|
||||
/* primary.c */
|
||||
|
||||
|
@ -557,7 +557,7 @@ IDirectSoundFullDuplexImpl_Initialize(
|
||||
return DSERR_ALREADYINITIALIZED;
|
||||
}
|
||||
|
||||
hr = DSOUND_Create8(&IID_IDirectSound8, &This->renderer_device);
|
||||
hr = DSOUND_Create8(&IID_IDirectSound8, (void **)&This->renderer_device);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = IDirectSound_Initialize(This->renderer_device, pRendererGuid);
|
||||
if (hr != DS_OK) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user