Class VolumeCalculator

java.lang.Object
org.collebol.client.math.VolumeCalculator

public class VolumeCalculator extends Object
The VolumeCalculator class is responsible for calculating the volume of a sound based on its position relative to the listener's position. It uses the reference distance and roll-off factor of the sound to determine how the volume decreases with distance.
Since:
1.0-dev
Author:
ColleBol - contact@collebol.org
  • Constructor Details

    • VolumeCalculator

      public VolumeCalculator()
  • Method Details

    • calculate

      public static float calculate(Sound sound, Vector2D listenerPosition)
      Calculates the volume of a sound based on its position relative to the listener's position.
      Parameters:
      sound - the sound whose volume is to be calculated
      listenerPosition - the position of the listener
      Returns:
      the calculated volume