Module: wine
Branch: master
Commit: 8de6b7da4035cc4bb8f4a2276de7e34d169935f6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8de6b7da4035cc4bb8f4a2276…
Author: Romain Iehl <romain.iehl.wine(a)gmail.com>
Date: Thu Jul 5 19:30:18 2007 +0200
dsound: Simplify the calculation of sound attenuation due to distance.
---
dlls/dsound/sound3d.c | 17 ++---------------
1 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/dlls/dsound/sound3d.c b/dlls/dsound/sound3d.c
index 0e4ea0e..ce7899f 100644
--- a/dlls/dsound/sound3d.c
+++ b/dlls/dsound/sound3d.c
@@ -53,8 +53,6 @@
#include "dsdriver.h"
#include "dsound_private.h"
-/* default intensity level for human ears */
-#define DEFAULT_INTENSITY 0.000000000001f
/* default velocity of sound in the air */
#define DEFAULT_VELOCITY 340
@@ -167,9 +165,6 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
{
/* volume, at which the sound will be played after all calcs. */
D3DVALUE lVolume = 0;
- /* intensity (used for distance related stuff) */
- double flIntensity;
- double flTemp;
/* stuff for distance related stuff calc. */
D3DVECTOR vDistance;
D3DVALUE flDistance = 0;
@@ -223,16 +218,8 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
if (flDistance < dsb->ds3db_ds3db.flMinDistance)
flDistance = dsb->ds3db_ds3db.flMinDistance;
- /* the following formula is taken from my physics book. I think it's ok for the *real* world...i hope m$ does it that way */
- lVolume += 10000; /* ms likes working with negative volume...i don't */
- lVolume /= 1000; /* convert hundreths of dB into B */
- /* intensity level (loudness) = log10(Intensity/DefaultIntensity)...therefore */
- flIntensity = pow(10,lVolume)*DEFAULT_INTENSITY;
- flTemp = (flDistance/dsb->ds3db_ds3db.flMinDistance)*(flDistance/dsb->ds3db_ds3db.flMinDistance);
- flIntensity /= flTemp;
- lVolume = log10(flIntensity/DEFAULT_INTENSITY);
- lVolume *= 1000; /* convert back to hundreths of dB */
- lVolume -= 10000; /* we need to do it in ms way */
+ /* attenuation proportional to the distance squared, converted to millibels as in lVolume*/
+ lVolume -= log10(flDistance/dsb->ds3db_ds3db.flMinDistance * flDistance/dsb->ds3db_ds3db.flMinDistance)*1000;
TRACE("dist. att: Distance = %f, MinDistance = %f => adjusting volume %d to %f\n", flDistance, dsb->ds3db_ds3db.flMinDistance, dsb->ds3db_lVolume, lVolume);
/* conning */
Module: wine
Branch: master
Commit: 3a8ae53de4e63dae3dbe130f0f13d4110ab0ece2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3a8ae53de4e63dae3dbe130f0…
Author: Romain Iehl <romain.iehl.wine(a)gmail.com>
Date: Thu Jul 5 18:55:39 2007 +0200
dsound: Fix bug preventing correct calculation of the sound parameters
of a 3Dbuffer, when an application calls CommitDeferredSettings after
the 3DBuffer has been released.
---
dlls/dsound/sound3d.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/dlls/dsound/sound3d.c b/dlls/dsound/sound3d.c
index f6ae455..0e4ea0e 100644
--- a/dlls/dsound/sound3d.c
+++ b/dlls/dsound/sound3d.c
@@ -326,11 +326,6 @@ static void DSOUND_ChangeListener(IDirectSound3DListenerImpl *ds3dl)
TRACE("(%p)\n",ds3dl);
for (i = 0; i < ds3dl->device->nrofbuffers; i++)
{
- /* some buffers don't have 3d buffer (Ultima IX seems to
- crash without the following line) */
- if (ds3dl->device->buffers[i]->ds3db == NULL)
- continue;
-
/* check if this buffer is waiting for recalculation */
if (ds3dl->device->buffers[i]->ds3db_need_recalc)
{