Commit e9ebbfc0 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Now that reference counting is correct, there is no need to check if

the base object goes away.
parent 5cab2b35
......@@ -400,16 +400,6 @@ static DWORD WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) {
}
}
if (This->ds3db) {
WARN("ds3db still has reference\n");
EnterCriticalSection(&(This->ds3db->lock));
This->ds3db->dsb = NULL;
LeaveCriticalSection(&(This->ds3db->lock));
}
if (This->iks)
IKsPropertySet_Release((LPKSPROPERTYSET)This->iks);
if (This->notifies != NULL)
HeapFree(GetProcessHeap(), 0, This->notifies);
......
......@@ -342,7 +342,6 @@ struct IDirectSound3DBufferImpl
DWORD ref;
/* IDirectSound3DBufferImpl fields */
IDirectSoundBufferImpl* dsb;
CRITICAL_SECTION lock;
};
HRESULT WINAPI IDirectSound3DBufferImpl_Create(
......
......@@ -397,7 +397,6 @@ static ULONG WINAPI IDirectSound3DBufferImpl_Release(LPDIRECTSOUND3DBUFFER iface
if (!ulReturn) {
This->dsb->ds3db = NULL;
IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER8)This->dsb);
DeleteCriticalSection(&(This->lock));
HeapFree(GetProcessHeap(),0,This);
TRACE("(%p) released\n",This);
}
......@@ -423,10 +422,8 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetAllParameters(
return DSERR_INVALIDPARAM;
}
if (This->dsb) {
TRACE("returning: all parameters\n");
*lpDs3dBuffer = This->dsb->ds3db_ds3db;
}
return DS_OK;
}
......@@ -436,12 +433,10 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeAngles(
LPDWORD lpdwOutsideConeAngle)
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
if (This->dsb) {
TRACE("returning: Inside Cone Angle = %ld degrees; Outside Cone Angle = %ld degrees\n",
This->dsb->ds3db_ds3db.dwInsideConeAngle, This->dsb->ds3db_ds3db.dwOutsideConeAngle);
*lpdwInsideConeAngle = This->dsb->ds3db_ds3db.dwInsideConeAngle;
*lpdwOutsideConeAngle = This->dsb->ds3db_ds3db.dwOutsideConeAngle;
}
return DS_OK;
}
......@@ -450,13 +445,11 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeOrientation(
LPD3DVECTOR lpvConeOrientation)
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
if (This->dsb) {
TRACE("returning: Cone Orientation vector = (%f,%f,%f)\n",
This->dsb->ds3db_ds3db.vConeOrientation.u1.x,
This->dsb->ds3db_ds3db.vConeOrientation.u2.y,
This->dsb->ds3db_ds3db.vConeOrientation.u3.z);
*lpvConeOrientation = This->dsb->ds3db_ds3db.vConeOrientation;
}
return DS_OK;
}
......@@ -465,10 +458,8 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetConeOutsideVolume(
LPLONG lplConeOutsideVolume)
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
if (This->dsb) {
TRACE("returning: Cone Outside Volume = %ld\n", This->dsb->ds3db_ds3db.lConeOutsideVolume);
*lplConeOutsideVolume = This->dsb->ds3db_ds3db.lConeOutsideVolume;
}
return DS_OK;
}
......@@ -477,10 +468,8 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetMaxDistance(
LPD3DVALUE lpfMaxDistance)
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
if (This->dsb) {
TRACE("returning: Max Distance = %f\n", This->dsb->ds3db_ds3db.flMaxDistance);
*lpfMaxDistance = This->dsb->ds3db_ds3db.flMaxDistance;
}
return DS_OK;
}
......@@ -489,10 +478,8 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetMinDistance(
LPD3DVALUE lpfMinDistance)
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
if (This->dsb) {
TRACE("returning: Min Distance = %f\n", This->dsb->ds3db_ds3db.flMinDistance);
*lpfMinDistance = This->dsb->ds3db_ds3db.flMinDistance;
}
return DS_OK;
}
......@@ -501,10 +488,8 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetMode(
LPDWORD lpdwMode)
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
if (This->dsb) {
TRACE("returning: Mode = %ld\n", This->dsb->ds3db_ds3db.dwMode);
*lpdwMode = This->dsb->ds3db_ds3db.dwMode;
}
return DS_OK;
}
......@@ -513,13 +498,11 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetPosition(
LPD3DVECTOR lpvPosition)
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
if (This->dsb) {
TRACE("returning: Position vector = (%f,%f,%f)\n",
This->dsb->ds3db_ds3db.vPosition.u1.x,
This->dsb->ds3db_ds3db.vPosition.u2.y,
This->dsb->ds3db_ds3db.vPosition.u3.z);
*lpvPosition = This->dsb->ds3db_ds3db.vPosition;
}
return DS_OK;
}
......@@ -528,13 +511,11 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_GetVelocity(
LPD3DVECTOR lpvVelocity)
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
if (This->dsb) {
TRACE("returning: Velocity vector = (%f,%f,%f)\n",
This->dsb->ds3db_ds3db.vVelocity.u1.x,
This->dsb->ds3db_ds3db.vVelocity.u2.y,
This->dsb->ds3db_ds3db.vVelocity.u3.z);
*lpvVelocity = This->dsb->ds3db_ds3db.vVelocity;
}
return DS_OK;
}
......@@ -558,9 +539,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetAllParameters(
return status;
}
EnterCriticalSection(&This->lock);
if (This->dsb) {
TRACE("setting: all parameters; dwApply = %ld\n", dwApply);
This->dsb->ds3db_ds3db = *lpcDs3dBuffer;
......@@ -570,10 +548,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetAllParameters(
}
This->dsb->ds3db_need_recalc = TRUE;
status = DS_OK;
} else
WARN("pointer no longer valid\n");
LeaveCriticalSection(&This->lock);
return status;
}
......@@ -587,7 +561,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeAngles(
ICOM_THIS(IDirectSound3DBufferImpl,iface);
TRACE("setting: Inside Cone Angle = %ld; Outside Cone Angle = %ld; dwApply = %ld\n",
dwInsideConeAngle, dwOutsideConeAngle, dwApply);
if (This->dsb) {
This->dsb->ds3db_ds3db.dwInsideConeAngle = dwInsideConeAngle;
This->dsb->ds3db_ds3db.dwOutsideConeAngle = dwOutsideConeAngle;
if (dwApply == DS3D_IMMEDIATE)
......@@ -595,7 +568,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeAngles(
DSOUND_Mix3DBuffer(This->dsb);
}
This->dsb->ds3db_need_recalc = TRUE;
}
return DS_OK;
}
......@@ -606,7 +578,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOrientation(
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
TRACE("setting: Cone Orientation vector = (%f,%f,%f); dwApply = %ld\n", x, y, z, dwApply);
if (This->dsb) {
This->dsb->ds3db_ds3db.vConeOrientation.u1.x = x;
This->dsb->ds3db_ds3db.vConeOrientation.u2.y = y;
This->dsb->ds3db_ds3db.vConeOrientation.u3.z = z;
......@@ -616,7 +587,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOrientation(
DSOUND_Mix3DBuffer(This->dsb);
}
This->dsb->ds3db_need_recalc = TRUE;
}
return DS_OK;
}
......@@ -627,7 +597,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOutsideVolume(
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
TRACE("setting: ConeOutsideVolume = %ld; dwApply = %ld\n", lConeOutsideVolume, dwApply);
if (This->dsb) {
This->dsb->ds3db_ds3db.lConeOutsideVolume = lConeOutsideVolume;
if (dwApply == DS3D_IMMEDIATE)
{
......@@ -635,7 +604,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetConeOutsideVolume(
DSOUND_Mix3DBuffer(This->dsb);
}
This->dsb->ds3db_need_recalc = TRUE;
}
return DS_OK;
}
......@@ -646,7 +614,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetMaxDistance(
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
TRACE("setting: MaxDistance = %f; dwApply = %ld\n", fMaxDistance, dwApply);
if (This->dsb) {
This->dsb->ds3db_ds3db.flMaxDistance = fMaxDistance;
if (dwApply == DS3D_IMMEDIATE)
{
......@@ -654,7 +621,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetMaxDistance(
DSOUND_Mix3DBuffer(This->dsb);
}
This->dsb->ds3db_need_recalc = TRUE;
}
return DS_OK;
}
......@@ -665,7 +631,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetMinDistance(
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
TRACE("setting: MinDistance = %f; dwApply = %ld\n", fMinDistance, dwApply);
if (This->dsb) {
This->dsb->ds3db_ds3db.flMinDistance = fMinDistance;
if (dwApply == DS3D_IMMEDIATE)
{
......@@ -673,7 +638,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetMinDistance(
DSOUND_Mix3DBuffer(This->dsb);
}
This->dsb->ds3db_need_recalc = TRUE;
}
return DS_OK;
}
......@@ -684,7 +648,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetMode(
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
TRACE("setting: Mode = %ld; dwApply = %ld\n", dwMode, dwApply);
if (This->dsb) {
This->dsb->ds3db_ds3db.dwMode = dwMode;
if (dwApply == DS3D_IMMEDIATE)
{
......@@ -692,7 +655,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetMode(
DSOUND_Mix3DBuffer(This->dsb);
}
This->dsb->ds3db_need_recalc = TRUE;
}
return DS_OK;
}
......@@ -703,7 +665,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetPosition(
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
TRACE("setting: Position vector = (%f,%f,%f); dwApply = %ld\n", x, y, z, dwApply);
if (This->dsb) {
This->dsb->ds3db_ds3db.vPosition.u1.x = x;
This->dsb->ds3db_ds3db.vPosition.u2.y = y;
This->dsb->ds3db_ds3db.vPosition.u3.z = z;
......@@ -713,7 +674,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetPosition(
DSOUND_Mix3DBuffer(This->dsb);
}
This->dsb->ds3db_need_recalc = TRUE;
}
return DS_OK;
}
......@@ -724,7 +684,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetVelocity(
{
ICOM_THIS(IDirectSound3DBufferImpl,iface);
TRACE("setting: Velocity vector = (%f,%f,%f); dwApply = %ld\n", x, y, z, dwApply);
if (This->dsb) {
This->dsb->ds3db_ds3db.vVelocity.u1.x = x;
This->dsb->ds3db_ds3db.vVelocity.u2.y = y;
This->dsb->ds3db_ds3db.vVelocity.u3.z = z;
......@@ -734,7 +693,6 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetVelocity(
DSOUND_Mix3DBuffer(This->dsb);
}
This->dsb->ds3db_need_recalc = TRUE;
}
return DS_OK;
}
......@@ -804,8 +762,6 @@ HRESULT WINAPI IDirectSound3DBufferImpl_Create(
ds3db->dsb->ds3db_need_recalc = TRUE;
InitializeCriticalSection(&(ds3db->lock));
IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER8)dsb);
*pds3db = ds3db;
......
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