Distance attenuation/falloff model for 3D positional audio.
Enumerator |
---|
NO_ATTENUATION | No distance attenuation; sound has the same volume regardless of distance between the sound instance and the listener.
|
INVERSE_DISTANCE | Attenuate the amplitude of the sound by the inverse distance between the sound instance and the listener according to the formula:
gain = dmin / (dmin + r * (clamp(d, dmin, dmax) - dmin))
where:
- d is the linear distance between the sound instance and the listener,
- dmin = minDistance,
- dmax = maxDistance,
- r = rolloffFactor.
- Note
- When using this attenuation model, it is recommended to use a rolloffFactor greater than or equal to 1.
- Warning
- When using this attenuation model:
- minDistance must be less than or equal to maxDistance.
- minDistance must be greater than 0.
- rolloffFactor must be greater than 0.
|
LINEAR_DISTANCE | Attenuate the amplitude of the sound by the linear distance between the sound instance and the listener according to the formula:
gain = 1 - r * (clamp(d, dmin, dmax) - dmin) / (dmax - dmin)
where:
- d is the linear distance between the sound instance and the listener,
- dmin = minDistance,
- dmax = maxDistance,
- r = rolloffFactor.
- Warning
- When using this attenuation model:
- minDistance must be less than or equal to maxDistance.
- rolloffFactor must be between 0 and 1 (inclusive).
|
EXPONENTIAL_DISTANCE | Attenuate the amplitude of the sound by the exponential distance between the sound instance and the listener according to the formula:
gain = pow(clamp(d, dmin, dmax) / dmin, -r)
where:
- d is the linear distance between the sound instance and the listener,
- dmin = minDistance,
- dmax = maxDistance,
- r = rolloffFactor.
- Note
- When using this attenuation model, it is recommended to use a rolloffFactor greater than or equal to 1.
- Warning
- When using this attenuation model:
- minDistance must be less than or equal to maxDistance.
- minDistance must be greater than 0.
- rolloffFactor must be greater than 0.
|