Class Listener


  • public final class Listener
    extends Object
    This class represents the human listener in the Sound3D environment. It provides methods for controlling the position, orientation as well as other properties associated with the listener.
    Author:
    Athomas Goldberg, Sven Gothel, et al.
    • Constructor Summary

      Constructors 
      Constructor Description
      Listener()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float getGain()
      Gets the value of the gain, or volume of the audio in the environment relative to the listener.
      float[] getOrientation()
      Gets the orientation of the Listener in the Sound3D environment.
      Vec3f getPosition()
      Gets the position in (x-y-z coordinates) of the Listener in the Sound3D environment.
      Vec3f getVelocity()
      Gets the velocity in (x-y-z coordinates) of the Listener in the Sound3D environment.
      void setGain​(float gain)
      Sets the Gain, or volume of the audio in the environment relative to the listener
      void setOrientation​(float[] orientation)
      Sets the orientation of the Listener in the Sound3D environment.
      void setPosition​(float x, float y, float z)
      Sets the position in (x-y-z coordinates) of the Listener in the Sound3D environment.
      void setPosition​(Vec3f position)
      Sets the position in (x-y-z coordinates) of the Listener in the Sound3D environment.
      void setVelocity​(Vec3f velocity)
      Sets the velocity in (x-y-z coordinates) of the Listener in the Sound3D environment.
    • Constructor Detail

      • Listener

        public Listener()
    • Method Detail

      • setGain

        public void setGain​(float gain)
        Sets the Gain, or volume of the audio in the environment relative to the listener
        Parameters:
        gain - the gain, or volume
      • getGain

        public float getGain()
        Gets the value of the gain, or volume of the audio in the environment relative to the listener.
        Returns:
        the gain value.
      • setPosition

        public void setPosition​(float x,
                                float y,
                                float z)
        Sets the position in (x-y-z coordinates) of the Listener in the Sound3D environment.
        Parameters:
        x - The position of the listener along the X-axis in the Sound3D environment
        y - The position of the listener along the Y-axis in the Sound3D environment
        z - The position of the listener along the Z-axis in the Sound3D environment
      • setPosition

        public void setPosition​(Vec3f position)
        Sets the position in (x-y-z coordinates) of the Listener in the Sound3D environment.
        Parameters:
        position - a Vec3f object containing the x,y and z coordinates of Listener.
      • getPosition

        public Vec3f getPosition()
        Gets the position in (x-y-z coordinates) of the Listener in the Sound3D environment.
        Returns:
        a Vec3f object containing the x,y and z coordinates of Listener.
      • setVelocity

        public void setVelocity​(Vec3f velocity)
        Sets the velocity in (x-y-z coordinates) of the Listener in the Sound3D environment. Used in determining doppler shift.
        Parameters:
        velocity - a Vec3f object containing the velicity in x,y and z coordinates of Listener.
      • getVelocity

        public Vec3f getVelocity()
        Gets the velocity in (x-y-z coordinates) of the Listener in the Sound3D environment. Used in determining doppler shift.
        Returns:
        a Vec3f object containing the velicity in x,y and z coordinates of Listener.
      • setOrientation

        public void setOrientation​(float[] orientation)
        Sets the orientation of the Listener in the Sound3D environment. Orientation is expressed as `at` and `up` vectors.
        Parameters:
        orientation - The first 3 elements of the array should contain the `at` vector, the second 3 elements should contain the `up` vector.
      • getOrientation

        public float[] getOrientation()
        Gets the orientation of the Listener in the Sound3D environment. Orientation is expressed as `at` and `up` vectors.
        Returns:
        an array containing the orientation of the listener, a pair of 3-float vectors for x,y,z. The first 3 elements of the array contain the `at` vector, the second 3 elements contain the `up` vector.