Class ListenerData

java.lang.Object
com.ardor3d.audio.ListenerData

public class ListenerData extends Object
The listenerData class is used to store information about the listener's position and orientation. A ListenerData object can be obtained using SoundSystem's getListenerData() method. See Vector3 for more information about 3D coordinates and vectors.

SoundSystem License:

You are free to use this library for any purpose, commercial or otherwise. You may modify this library or source code, and distribute it any way you like, provided the following conditions are met:
1) You may not falsely claim to be the author of this library or any unmodified portion of it.
2) You may not copyright this library or a modified version of it and then sue me for copyright infringement.
3) If you modify the source code, you must clearly document the changes made before redistributing the modified source code, so other users know it is not the original code.
4) You are not required to give me credit for this library in any derived work, but if you do, you must also mention my website: http://www.paulscode.com
5) I the author will not be responsible for any damages (physical, financial, or otherwise) caused by the use if this library or any part of it.
6) I the author do not guarantee, warrant, or make any representations, either expressed or implied, regarding the use of this library or any part of it.

Author: Paul Lamb
http://www.paulscode.com
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    float
    Used for easy rotation along the x/z plane (for use in a first-person shooter type of application).
    A normalized vector indicating the direction the listener is facing
    Listener's position in 3D space
    A normalized vector indicating the up direction
    Listener's velocity in world-space
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor: Set this listener data to the origin facing along the z-axis
    ListenerData(float pX, float pY, float pZ, float lX, float lY, float lZ, float uX, float uY, float uZ, float a)
    Constructor: Set this listener data to the specified values for position and orientation.
    ListenerData(Vector3 p, Vector3 l, Vector3 u, float a)
    Constructor: Set this listener data to the specified values for position and orientation.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    setAngle(float a)
    Sets the listener's angle counterclockwise around the y-axis.
    void
    setData(float pX, float pY, float pZ, float lX, float lY, float lZ, float uX, float uY, float uZ, float a)
    Change this listener data using the specified coordinates for position and orientation.
    void
    Change this listener data to match the specified listener data.
    void
    setData(Vector3 p, Vector3 l, Vector3 u, float a)
    Change this listener data using the specified 3D vectors for position and orientation.
    void
    setOrientation(float lX, float lY, float lZ, float uX, float uY, float uZ)
    Changes the listeners orientation using the specified coordinates.
    void
    Changes the listeners orientation using the specified vectors.
    void
    setPosition(float x, float y, float z)
    Change this listener's position using the specified coordinates.
    void
    Change this listener's position using the specified vector.
    void
    setVelocity(float x, float y, float z)
    Change this listener's velocity in world-space.
    void
    Change this listener's velocity in world-space.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • position

      public Vector3 position
      Listener's position in 3D space
    • lookAt

      public Vector3 lookAt
      A normalized vector indicating the direction the listener is facing
    • up

      public Vector3 up
      A normalized vector indicating the up direction
    • velocity

      public Vector3 velocity
      Listener's velocity in world-space
    • angle

      public float angle
      Used for easy rotation along the x/z plane (for use in a first-person shooter type of application).
  • Constructor Details

    • ListenerData

      public ListenerData()
      Constructor: Set this listener data to the origin facing along the z-axis
    • ListenerData

      public ListenerData(float pX, float pY, float pZ, float lX, float lY, float lZ, float uX, float uY, float uZ, float a)
      Constructor: Set this listener data to the specified values for position and orientation.
      Parameters:
      pX - Listener's X coordinate.
      pY - Listener's Y coordinate.
      pZ - Listener's Z coordinate.
      lX - X element of the look-at direction.
      lY - Y element of the look-at direction.
      lZ - Z element of the look-at direction.
      uX - X element of the up direction.
      uY - Y element of the up direction.
      uZ - Z element of the up direction.
      a - Angle in radians that the listener is turned counterclockwise around the y-axis.
    • ListenerData

      public ListenerData(Vector3 p, Vector3 l, Vector3 u, float a)
      Constructor: Set this listener data to the specified values for position and orientation.
      Parameters:
      p - Position of the listener in 3D space.
      l - Normalized vector indicating the direction which the listener is facing.
      u - Normalized vector indicating the up direction.
      a - Angle in radians that the listener is turned counterclockwise around the y-axis.
  • Method Details

    • setData

      public void setData(float pX, float pY, float pZ, float lX, float lY, float lZ, float uX, float uY, float uZ, float a)
      Change this listener data using the specified coordinates for position and orientation.
      Parameters:
      pX - Listener's X coordinate.
      pY - Listener's Y coordinate.
      pZ - Listener's Z coordinate.
      lX - X element of the look-at direction.
      lY - Y element of the look-at direction.
      lZ - Z element of the look-at direction.
      uX - X element of the up direction.
      uY - Y element of the up direction.
      uZ - Z element of the up direction.
      a - Angle in radians that the listener is turned counterclockwise around the y-axis.
    • setData

      public void setData(Vector3 p, Vector3 l, Vector3 u, float a)
      Change this listener data using the specified 3D vectors for position and orientation.
      Parameters:
      p - Position of the listener in 3D space.
      l - Normalized vector indicating the direction which the listener is facing.
      u - Normalized vector indicating the up direction.
      a - Angle in radians that the listener is turned counterclockwise around the y-axis.
    • setData

      public void setData(ListenerData l)
      Change this listener data to match the specified listener data.
      Parameters:
      l - Listener data to use.
    • setPosition

      public void setPosition(float x, float y, float z)
      Change this listener's position using the specified coordinates.
      Parameters:
      x - Listener's X coordinate.
      y - Listener's Y coordinate.
      z - Listener's Z coordinate.
    • setPosition

      public void setPosition(Vector3 p)
      Change this listener's position using the specified vector.
      Parameters:
      p - New position.
    • setOrientation

      public void setOrientation(float lX, float lY, float lZ, float uX, float uY, float uZ)
      Changes the listeners orientation using the specified coordinates.
      Parameters:
      lX - X element of the look-at direction.
      lY - Y element of the look-at direction.
      lZ - Z element of the look-at direction.
      uX - X element of the up direction.
      uY - Y element of the up direction.
      uZ - Z element of the up direction.
    • setOrientation

      public void setOrientation(Vector3 l, Vector3 u)
      Changes the listeners orientation using the specified vectors.
      Parameters:
      l - Normalized vector representing the look-at direction.
      u - Normalized vector representing the up direction.
    • setVelocity

      public void setVelocity(Vector3 v)
      Change this listener's velocity in world-space.
      Parameters:
      v - New velocity.
    • setVelocity

      public void setVelocity(float x, float y, float z)
      Change this listener's velocity in world-space.
      Parameters:
      x - New velocity along world x-axis.
      y - New velocity along world y-axis.
      z - New velocity along world z-axis.
    • setAngle

      public void setAngle(float a)
      Sets the listener's angle counterclockwise around the y-axis.
      Parameters:
      a - Angle in radians.