Package com.jme3.audio
Class Listener
java.lang.Object
com.jme3.audio.Listener
Represents the audio listener in the 3D sound scene.
The listener defines the point of view from which sound is heard,
influencing spatial audio effects like panning and Doppler shift.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the forward direction vector of the listener.getLeft()
Gets the left direction vector of the listener.Gets the current location of the listener in world space.Gets the current rotation of the listener in world space.getUp()
Gets the up direction vector of the listener.Gets the current velocity of the listener.float
Gets the current volume of the listener.void
setLocation
(Vector3f location) Sets the location of the listener in world space.void
setRenderer
(AudioRenderer renderer) Sets theAudioRenderer
associated with this listener.void
setRotation
(Quaternion rotation) Sets the rotation of the listener in world space.void
setVelocity
(Vector3f velocity) Sets the velocity of the listener.void
setVolume
(float volume) Sets the volume of the listener.
-
Constructor Details
-
Listener
public Listener()Constructs a newListener
with default parameters. -
Listener
Constructs a newListener
by copying the properties of anotherListener
.- Parameters:
source
- TheListener
to copy the properties from.
-
-
Method Details
-
setRenderer
Sets theAudioRenderer
associated with this listener. The renderer is responsible for applying the listener's parameters to the audio output.- Parameters:
renderer
- TheAudioRenderer
to associate with.
-
getVolume
public float getVolume()Gets the current volume of the listener.- Returns:
- The current volume.
-
setVolume
public void setVolume(float volume) Sets the volume of the listener. If anAudioRenderer
is set, it will be notified of the volume change.- Parameters:
volume
- The new volume.
-
getLocation
Gets the current location of the listener in world space.- Returns:
- The listener's location as a
Vector3f
.
-
getRotation
Gets the current rotation of the listener in world space.- Returns:
- The listener's rotation as a
Quaternion
.
-
getVelocity
Gets the current velocity of the listener. This is used for Doppler effect calculations.- Returns:
- The listener's velocity as a
Vector3f
.
-
getLeft
Gets the left direction vector of the listener. This vector is derived from the listener's rotation.- Returns:
- The listener's left direction as a
Vector3f
.
-
getUp
Gets the up direction vector of the listener. This vector is derived from the listener's rotation.- Returns:
- The listener's up direction as a
Vector3f
.
-
getDirection
Gets the forward direction vector of the listener. This vector is derived from the listener's rotation.- Returns:
- The listener's forward direction.
-
setLocation
Sets the location of the listener in world space. If anAudioRenderer
is set, it will be notified of the position change.- Parameters:
location
- The new location of the listener.
-
setRotation
Sets the rotation of the listener in world space. If anAudioRenderer
is set, it will be notified of the rotation change.- Parameters:
rotation
- The new rotation of the listener.
-
setVelocity
Sets the velocity of the listener. This is used for Doppler effect calculations. If anAudioRenderer
is set, it will be notified of the velocity change.- Parameters:
velocity
- The new velocity of the listener.
-