Lines Matching refs:distance
33 #include "core/platform/audio/Distance.h"
52 double DistanceEffect::gain(double distance)
54 // don't go beyond maximum distance
55 distance = min(distance, m_maxDistance);
57 // if clamped, don't get closer than reference distance
59 distance = max(distance, m_refDistance);
63 return linearGain(distance);
65 return inverseGain(distance);
67 return exponentialGain(distance);
73 double DistanceEffect::linearGain(double distance)
77 return (1.0 - m_rolloffFactor * (distance - m_refDistance) / (m_maxDistance - m_refDistance));
80 double DistanceEffect::inverseGain(double distance)
82 return m_refDistance / (m_refDistance + m_rolloffFactor * (distance - m_refDistance));
85 double DistanceEffect::exponentialGain(double distance)
87 return pow(distance / m_refDistance, -m_rolloffFactor);