While amplification/attenuation commute (mulplication of
scaling factors), clamping operations do not. The order
in which various gain related operations are applied is:
Distance attenuation is calculated first, including
minimum (REFERENCE_DISTANCE) and maximum (MAX_DISTANCE)
thresholds. If the Source is directional (CONE_INNER_ANGLE
less than CONE_OUTER_ANGLE), an angle-dependent attenuation
is calculated depending on CONE_OUTER_GAIN, and multiplied
with the distance dependent attenuation.
The resulting attenuation factor for the given angle and
distance between Listener and Source is multiplied
with Source GAIN. The effective GAIN computed this way
is compared against MIN_GAIN and MAX_GAIN thresholds.
The result is guaranteed to be clamped to [MIN_GAIN, MAX_GAIN],
and subsequently multiplied by Listener GAIN which serves
as an overall volume control. The implementation is free
to clamp Listener GAIN if necessary due to hardware or
implementation constraints.