Distance Factor

DirectSound uses meters as the default unit of distance measurements. If your application does not use meters, it can set a distance factor. For an overview, see Distance Measurements.

After you have set the distance factor for a listener, use your application's own distance units in calls to any methods that apply to that listener. Suppose, for example, that the basic unit of measurement in your application is the foot. You call the IDirectSound3DListener::SetDistanceFactor method, specifying 0.3048 as the flDistanceFactor parameter. (This value is the number of meters in a foot.) 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 with the IDirectSound3DListener::GetDistanceFactor method. The default value is DS3D_DEFAULTDISTANCEFACTOR, defined as 1.0, meaning that a distance unit corresponds to 1 meter. At the default value, a position vector of (3.0,7.2,-20.9) means that the object is 3.0 m to the right of, 7.2 m above, and 20.9 m behind the origin. If the distance factor is changed to 2.0, the same position vector means that the object is 6.0 m to the right of, 14.4 m above, and 41.8 m behind the origin.