Commit e0d81e55 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dsound: Merge IDirectSound3DBuffer into the secondary buffer object.

parent a5d21200
......@@ -812,15 +812,9 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(IDirectSoundBuffer8
}
if ( IsEqualGUID( &IID_IDirectSound3DBuffer, riid ) ) {
if (!This->ds3db)
IDirectSound3DBufferImpl_Create(This, &(This->ds3db));
if (This->ds3db) {
IDirectSound3DBuffer_AddRef((LPDIRECTSOUND3DBUFFER)This->ds3db);
*ppobj = This->ds3db;
return S_OK;
}
WARN("IID_IDirectSound3DBuffer\n");
return E_NOINTERFACE;
IDirectSound3DBuffer_AddRef(&This->IDirectSound3DBuffer_iface);
*ppobj = &This->IDirectSound3DBuffer_iface;
return S_OK;
}
if ( IsEqualGUID( &IID_IDirectSound3DListener, riid ) ) {
......@@ -895,10 +889,12 @@ HRESULT IDirectSoundBufferImpl_Create(
TRACE("Created buffer at %p\n", dsb);
dsb->ref = 0;
dsb->ref3D = 0;
dsb->refiks = 0;
dsb->numIfaces = 0;
dsb->device = device;
dsb->IDirectSoundBuffer8_iface.lpVtbl = &dsbvt;
dsb->IDirectSound3DBuffer_iface.lpVtbl = &ds3dbvt;
dsb->IKsPropertySet_iface.lpVtbl = &iksbvt;
/* size depends on version */
......@@ -1040,12 +1036,6 @@ HRESULT IDirectSoundBufferImpl_Destroy(
* this object until it is ready to be deleted */
InterlockedIncrement(&pdsb->numIfaces);
if (pdsb->ds3db) {
WARN("ds3db not NULL\n");
IDirectSound3DBufferImpl_Destroy(pdsb->ds3db);
pdsb->ds3db = NULL;
}
if (pdsb->notify) {
WARN("notify not NULL\n");
IDirectSoundNotifyImpl_Destroy(pdsb->notify);
......@@ -1090,6 +1080,7 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
dsb->buffer->ref++;
list_add_head(&dsb->buffer->buffers, &dsb->entry);
dsb->ref = 0;
dsb->ref3D = 0;
dsb->refiks = 0;
dsb->numIfaces = 0;
dsb->state = STATE_STOPPED;
......@@ -1098,7 +1089,6 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
dsb->notifies = NULL;
dsb->nrofnotifies = 0;
dsb->device = device;
dsb->ds3db = NULL;
DSOUND_RecalcFormat(dsb);
RtlInitializeResource(&dsb->lock);
......
......@@ -49,7 +49,6 @@ typedef struct IDirectSoundBufferImpl IDirectSoundBufferImpl;
typedef struct IDirectSoundCaptureImpl IDirectSoundCaptureImpl;
typedef struct IDirectSoundCaptureBufferImpl IDirectSoundCaptureBufferImpl;
typedef struct IDirectSoundNotifyImpl IDirectSoundNotifyImpl;
typedef struct IDirectSound3DBufferImpl IDirectSound3DBufferImpl;
typedef struct DirectSoundDevice DirectSoundDevice;
typedef struct DirectSoundCaptureDevice DirectSoundCaptureDevice;
......@@ -165,6 +164,7 @@ struct IDirectSoundBufferImpl
{
IDirectSoundBuffer8 IDirectSoundBuffer8_iface;
IDirectSound3DListener IDirectSound3DListener_iface; /* only primary buffer */
IDirectSound3DBuffer IDirectSound3DBuffer_iface; /* only secondary buffer */
IKsPropertySet IKsPropertySet_iface;
LONG numIfaces; /* "in use interfaces" refcount */
LONG ref, ref3D, refiks;
......@@ -190,7 +190,6 @@ struct IDirectSoundBufferImpl
int nrofnotifies;
/* DirectSound3DBuffer fields */
IDirectSound3DBufferImpl* ds3db;
DS3DBUFFER ds3db_ds3db;
LONG ds3db_lVolume;
BOOL ds3db_need_recalc;
......@@ -211,6 +210,7 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
IDirectSoundBufferImpl *pdsb) DECLSPEC_HIDDEN;
void secondarybuffer_destroy(IDirectSoundBufferImpl *This) DECLSPEC_HIDDEN;
const IDirectSound3DListenerVtbl ds3dlvt DECLSPEC_HIDDEN;
const IDirectSound3DBufferVtbl ds3dbvt DECLSPEC_HIDDEN;
const IKsPropertySetVtbl iksbvt DECLSPEC_HIDDEN;
/*****************************************************************************
......@@ -260,24 +260,6 @@ struct IDirectSoundCaptureBufferImpl
HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, IKsPropertySet **piks) DECLSPEC_HIDDEN;
/*****************************************************************************
* IDirectSound3DBuffer implementation structure
*/
struct IDirectSound3DBufferImpl
{
/* IUnknown fields */
const IDirectSound3DBufferVtbl *lpVtbl;
LONG ref;
/* IDirectSound3DBufferImpl fields */
IDirectSoundBufferImpl* dsb;
};
HRESULT IDirectSound3DBufferImpl_Create(
IDirectSoundBufferImpl *dsb,
IDirectSound3DBufferImpl **pds3db) DECLSPEC_HIDDEN;
HRESULT IDirectSound3DBufferImpl_Destroy(
IDirectSound3DBufferImpl *pds3db) DECLSPEC_HIDDEN;
/*******************************************************************************
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment