mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-30 05:53:45 +00:00
dsound: Take distance and Doppler factor into account.
This commit is contained in:
parent
23eca82ac3
commit
69d088ca5b
|
@ -168,7 +168,7 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
|
|||
float a, ingain;
|
||||
/* doppler shift related stuff */
|
||||
D3DVECTOR vRelativeVel;
|
||||
D3DVALUE flFreq, flRelativeVel, flLimitedVel;
|
||||
D3DVALUE flFreq, flRelativeVel, flLimitedVel, flVelocityFactor;
|
||||
|
||||
TRACE("(%p)\n",dsb);
|
||||
|
||||
|
@ -308,7 +308,8 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
|
|||
NOTE: if buffer moves TOWARDS the listener, its velocity component is NEGATIVE
|
||||
if buffer moves AWAY from listener, its velocity component is POSITIVE */
|
||||
flRelativeVel = ProjectVector(&vRelativeVel, &vDistance);
|
||||
flLimitedVel = max(-DEFAULT_VELOCITY/2, min(DEFAULT_VELOCITY/2, flRelativeVel));
|
||||
flVelocityFactor = dsb->device->ds3dl.flDistanceFactor * dsb->device->ds3dl.flDopplerFactor;
|
||||
flLimitedVel = max(-DEFAULT_VELOCITY/2, min(DEFAULT_VELOCITY/2, flRelativeVel * flVelocityFactor));
|
||||
/* formula taken from Gianicoli D.: Physics, 4th edition: */
|
||||
flFreq = dsb->ds3db_freq * (DEFAULT_VELOCITY/(DEFAULT_VELOCITY + flLimitedVel));
|
||||
TRACE("doppler: Relative velocity (component) = %f => Doppler shift: %ld Hz -> %f Hz\n",
|
||||
|
|
|
@ -1459,17 +1459,11 @@ static void test_doppler(GUID *guid, BOOL play)
|
|||
hr = IDirectSound3DListener_SetDistanceFactor(listener, 10, DS3D_DEFERRED);
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
|
||||
/* Wine TODO: The distance factor has no effect. */
|
||||
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 0, 0.1f, -9, 22050, 29400);
|
||||
/* Wine TODO: The distance factor has no effect. */
|
||||
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 0, 0.1f, 9, 22050, 17640);
|
||||
/* Wine TODO: The distance factor has no effect. */
|
||||
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 9, 0.1f, 0, 22050, 29400);
|
||||
/* Wine TODO: The distance factor has no effect. */
|
||||
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, -9, 0.1f, 0, 22050, 17640);
|
||||
/* Wine TODO: The distance factor has no effect. */
|
||||
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 0, 0.1f, -24, 22050, 44100);
|
||||
/* Wine TODO: The distance factor has no effect. */
|
||||
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 0, 0.1f, 24, 22050, 14700);
|
||||
|
||||
hr = IDirectSound3DListener_SetDistanceFactor(listener, DS3D_DEFAULTDISTANCEFACTOR, DS3D_DEFERRED);
|
||||
|
@ -1478,17 +1472,11 @@ static void test_doppler(GUID *guid, BOOL play)
|
|||
hr = IDirectSound3DListener_SetDopplerFactor(listener, 2, DS3D_DEFERRED);
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
|
||||
/* Wine TODO: The Doppler factor has no effect. */
|
||||
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 0, 1, -45, 22050, 29400);
|
||||
/* Wine TODO: The Doppler factor has no effect. */
|
||||
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 0, 1, 45, 22050, 17640);
|
||||
/* Wine TODO: The Doppler factor has no effect. */
|
||||
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 45, 1, 0, 22050, 29400);
|
||||
/* Wine TODO: The Doppler factor has no effect. */
|
||||
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, -45, 1, 0, 22050, 17640);
|
||||
/* Wine TODO: The Doppler factor has no effect. */
|
||||
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 0, 1, -120, 22050, 44100);
|
||||
/* Wine TODO: The Doppler factor has no effect. */
|
||||
check_doppler(dsound, listener, play, DS3DMODE_NORMAL, 0, 0, 1, 120, 22050, 14700);
|
||||
|
||||
hr = IDirectSound3DListener_SetDopplerFactor(listener, DS3D_DEFAULTDOPPLERFACTOR, DS3D_DEFERRED);
|
||||
|
|
Loading…
Reference in a new issue