Microsoft DirectX 8.1 (C++) |
The distance factor is the number of meters in a vector unit. By default, the distance factor is 1.0. If the velocity of a buffer is (2.0, 0.0, 0.0), the sound source is considered to be moving along the x-axis at 2 meters per second. Applications that are using a different unit of measurement for 3-D graphics vectors might want to change the distance factor accordingly.
Suppose, for example, that the basic unit of measurement in your application is the foot, or 0.3048 meters. You call the IDirectSound3DListener8::SetDistanceFactor method, specifying 0.3048 as the flDistanceFactor parameter. From then on, you continue using feet in parameters to method calls, and they are automatically converted to meters.
You can retrieve the current distance factor set for a listener by using the IDirectSound3DListener8::GetDistanceFactor method.
The distance factor mainly affects Doppler shift, by changing the actual velocity represented by n units per second. It does not directly affect rolloff, because the rate of attenuation over distance is based on the minimum distance in units. If you set the minimum distance for a given sound at 2 units, the volume will be halved at a distance of 4 units, whether those units are in feet, meters, or any other measure. For more information, see Minimum and Maximum Distances.