Commit 64cdecc6 authored by Anton Baskanov's avatar Anton Baskanov Committed by Alexandre Julliard

dsound: Avoid division by zero when calculating Doppler shift.

parent feaaa5bc
......@@ -298,7 +298,8 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
}
else if (!(dsb->ds3db_ds3db.vVelocity.x == dsb->device->ds3dl.vVelocity.x &&
dsb->ds3db_ds3db.vVelocity.y == dsb->device->ds3dl.vVelocity.y &&
dsb->ds3db_ds3db.vVelocity.z == dsb->device->ds3dl.vVelocity.z))
dsb->ds3db_ds3db.vVelocity.z == dsb->device->ds3dl.vVelocity.z) &&
!(vDistance.x == 0.0f && vDistance.y == 0.0f && vDistance.z == 0.0f))
{
/* calculate length of ds3db_ds3db.vVelocity component which causes Doppler Effect
NOTE: if buffer moves TOWARDS the listener, its velocity component is NEGATIVE
......
......@@ -1439,6 +1439,8 @@ static void test_doppler(GUID *guid, BOOL play)
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 0, 1, -90, 22050, 29400);
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 0, 1, 90, 22050, 17640);
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 0, 0, -90, 22050, 22050);
IDirectSound3DListener_Release(listener);
ref = IDirectSoundBuffer_Release(primary);
ok(!ref, "Got outstanding refcount %ld.\n", ref);
......
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