Commit 1671a83f authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

dsound: Fix rolloff factor calculation.

We should treat the rolloff factor as a factor of the distance of the buffer. For example, a rolloff factor of 2 should treat the buffer as if it were twice as far away from the listener as it is. The previous calculation would instead double the decibels of attenuation. Signed-off-by: 's avatarAndrew Eikum <aeikum@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent c0b30432
......@@ -205,9 +205,11 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
if (flDistance < dsb->ds3db_ds3db.flMinDistance)
flDistance = dsb->ds3db_ds3db.flMinDistance;
flDistance = dsb->ds3db_ds3db.flMinDistance + (flDistance - dsb->ds3db_ds3db.flMinDistance) * dsb->device->ds3dl.flRolloffFactor;
/* 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 * dsb->device->ds3dl.flRolloffFactor;
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 */
......
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