Commit 669b79b8 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Change secondary buffer variable name to secondary.

Fix AddRef and Release to use proper class.
parent 9cf9e5e7
...@@ -898,11 +898,11 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface( ...@@ -898,11 +898,11 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(
if ( IsEqualGUID(riid, &IID_IUnknown) || if ( IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirectSoundBuffer) || IsEqualGUID(riid, &IID_IDirectSoundBuffer) ||
IsEqualGUID(riid, &IID_IDirectSoundBuffer8) ) { IsEqualGUID(riid, &IID_IDirectSoundBuffer8) ) {
if (!This->dsb) if (!This->secondary)
SecondaryBufferImpl_Create(This, &(This->dsb)); SecondaryBufferImpl_Create(This, &(This->secondary));
if (This->dsb) { if (This->secondary) {
IDirectSoundBuffer8_AddRef((LPDIRECTSOUNDBUFFER8)This->dsb); IDirectSoundBuffer8_AddRef((LPDIRECTSOUNDBUFFER8)This->secondary);
*ppobj = This->dsb; *ppobj = This->secondary;
return S_OK; return S_OK;
} }
WARN("IID_IDirectSoundBuffer\n"); WARN("IID_IDirectSoundBuffer\n");
...@@ -1012,7 +1012,7 @@ HRESULT WINAPI IDirectSoundBufferImpl_Create( ...@@ -1012,7 +1012,7 @@ HRESULT WINAPI IDirectSoundBufferImpl_Create(
TRACE("Created buffer at %p\n", dsb); TRACE("Created buffer at %p\n", dsb);
dsb->ref = 0; dsb->ref = 0;
dsb->dsb = 0; dsb->secondary = 0;
dsb->dsound = ds; dsb->dsound = ds;
dsb->lpVtbl = &dsbvt; dsb->lpVtbl = &dsbvt;
dsb->iks = NULL; dsb->iks = NULL;
...@@ -1200,10 +1200,10 @@ HRESULT WINAPI IDirectSoundBufferImpl_Destroy( ...@@ -1200,10 +1200,10 @@ HRESULT WINAPI IDirectSoundBufferImpl_Destroy(
pdsb->notify = NULL; pdsb->notify = NULL;
} }
if (pdsb->dsb) { if (pdsb->secondary) {
WARN("dsb not NULL\n"); WARN("dsb not NULL\n");
SecondaryBufferImpl_Destroy(pdsb->dsb); SecondaryBufferImpl_Destroy(pdsb->secondary);
pdsb->dsb = NULL; pdsb->secondary = NULL;
} }
while (IDirectSoundBuffer8_Release((LPDIRECTSOUNDBUFFER8)pdsb) > 0); while (IDirectSoundBuffer8_Release((LPDIRECTSOUNDBUFFER8)pdsb) > 0);
...@@ -1226,7 +1226,7 @@ static HRESULT WINAPI SecondaryBufferImpl_QueryInterface( ...@@ -1226,7 +1226,7 @@ static HRESULT WINAPI SecondaryBufferImpl_QueryInterface(
static ULONG WINAPI SecondaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface) static ULONG WINAPI SecondaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface)
{ {
IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; SecondaryBufferImpl *This = (SecondaryBufferImpl *)iface;
ULONG ref = InterlockedIncrement(&(This->ref)); ULONG ref = InterlockedIncrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref - 1); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref; return ref;
...@@ -1234,12 +1234,12 @@ static ULONG WINAPI SecondaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface) ...@@ -1234,12 +1234,12 @@ static ULONG WINAPI SecondaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface)
static ULONG WINAPI SecondaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) static ULONG WINAPI SecondaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface)
{ {
IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; SecondaryBufferImpl *This = (SecondaryBufferImpl *)iface;
ULONG ref = InterlockedDecrement(&(This->ref)); ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1); TRACE("(%p) ref was %ld\n", This, ref + 1);
if (!ref) { if (!ref) {
This->dsb->dsb = NULL; This->dsb->secondary = NULL;
IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER8)This->dsb); IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER8)This->dsb);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
TRACE("(%p) released\n", This); TRACE("(%p) released\n", This);
......
...@@ -366,7 +366,7 @@ static HRESULT WINAPI DSOUND_CreateSoundBuffer( ...@@ -366,7 +366,7 @@ static HRESULT WINAPI DSOUND_CreateSoundBuffer(
if (dsb) { if (dsb) {
hres = SecondaryBufferImpl_Create(dsb, (SecondaryBufferImpl**)ppdsb); hres = SecondaryBufferImpl_Create(dsb, (SecondaryBufferImpl**)ppdsb);
if (*ppdsb) { if (*ppdsb) {
dsb->dsb = (SecondaryBufferImpl*)*ppdsb; dsb->secondary = (SecondaryBufferImpl*)*ppdsb;
IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER)*ppdsb); IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER)*ppdsb);
} else } else
WARN("SecondaryBufferImpl_Create failed\n"); WARN("SecondaryBufferImpl_Create failed\n");
...@@ -535,7 +535,7 @@ static HRESULT WINAPI IDirectSoundImpl_DuplicateSoundBuffer( ...@@ -535,7 +535,7 @@ static HRESULT WINAPI IDirectSoundImpl_DuplicateSoundBuffer(
dsb->dsound = This; dsb->dsound = This;
dsb->ds3db = NULL; dsb->ds3db = NULL;
dsb->iks = NULL; /* FIXME? */ dsb->iks = NULL; /* FIXME? */
dsb->dsb = NULL; dsb->secondary = NULL;
/* variable sized struct so calculate size based on format */ /* variable sized struct so calculate size based on format */
size = sizeof(WAVEFORMATEX) + pdsb->pwfx->cbSize; size = sizeof(WAVEFORMATEX) + pdsb->pwfx->cbSize;
...@@ -567,7 +567,7 @@ static HRESULT WINAPI IDirectSoundImpl_DuplicateSoundBuffer( ...@@ -567,7 +567,7 @@ static HRESULT WINAPI IDirectSoundImpl_DuplicateSoundBuffer(
} else { } else {
hres = SecondaryBufferImpl_Create(dsb, (SecondaryBufferImpl**)ppdsb); hres = SecondaryBufferImpl_Create(dsb, (SecondaryBufferImpl**)ppdsb);
if (*ppdsb) { if (*ppdsb) {
dsb->dsb = (SecondaryBufferImpl*)*ppdsb; dsb->secondary = (SecondaryBufferImpl*)*ppdsb;
IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER8)*ppdsb); IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER8)*ppdsb);
} else } else
WARN("SecondaryBufferImpl_Create failed\n"); WARN("SecondaryBufferImpl_Create failed\n");
......
...@@ -199,7 +199,7 @@ struct IDirectSoundBufferImpl ...@@ -199,7 +199,7 @@ struct IDirectSoundBufferImpl
const IDirectSoundBuffer8Vtbl *lpVtbl; const IDirectSoundBuffer8Vtbl *lpVtbl;
LONG ref; LONG ref;
/* IDirectSoundBufferImpl fields */ /* IDirectSoundBufferImpl fields */
SecondaryBufferImpl* dsb; SecondaryBufferImpl* secondary;
IDirectSoundImpl* dsound; IDirectSoundImpl* dsound;
CRITICAL_SECTION lock; CRITICAL_SECTION lock;
PIDSDRIVERBUFFER hwbuf; PIDSDRIVERBUFFER hwbuf;
......
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