src/source.js
function _computeDistanceOutsideRoom(distance) {
  // We apply a linear ramp from 1 to 0 as the source is up to 1m outside.
  let gain = 1;
  if (distance > Utils.EPSILON_FLOAT) {
    gain = 1 - distance / Utils.SOURCE_MAX_OUTSIDE_ROOM_DISTANCE;

    // Clamp gain between 0 and 1.
    gain = Math.max(0, Math.min(1, gain));
  }
  return gain;
}
function _computeDistanceOutsideRoom(distance) {
  // We apply a linear ramp from 1 to 0 as the source is up to 1m outside.
  let gain = 1;
  if (distance > Utils.EPSILON_FLOAT) {
    gain = 1 - distance / Utils.SOURCE_MAX_OUTSIDE_ROOM_DISTANCE;

    // Clamp gain between 0 and 1.
    gain = Math.max(0, Math.min(1, gain));
  }
  return gain;
}
function _computeDistanceOutsideRoom ( distance ) { // We apply a linear ramp from 1 to 0 as the source is up to 1m outside. let gain = 1 ; if ( distance > Utils . EPSILON_FLOAT ) { gain = 1 - distance / Utils . SOURCE_MAX_OUTSIDE_ROOM_DISTANCE ; // Clamp gain between 0 and 1. gain = Math . max ( 0 , Math . min ( 1 , gain ) ) ; } return gain ; }
Determine the distance a source is outside of a room. Attenuate gain going
to the reflections and reverb when the source is outside of the room.
@param {Number} distance Distance in meters.
@return {Number} Gain (linear) of source.
@private
Determine the distance a source is outside of a room . Attenuate gain going to the reflections and reverb when the source is outside of the room .