Class AudioListener
The position and orientation of the listener every PannerNode of a
context is heard from, the Web Audio AudioListener. Get it with
BaseAudioContext.getListener().
The coordinate system is right-handed: by default the listener is at the
origin facing -Z, with +Y up and +X to the right. Every coordinate is an
audio rate AudioParam, so a moving listener can be automated.
-
Method Summary
Modifier and TypeMethodDescriptionX of the direction faced, 0 by default.Y of the direction faced, 0 by default.Z of the direction faced, -1 by default.Position on X, 0 by default.Position on Y, 0 by default.Position on Z, 0 by default.getUpX()X of the top of the head, 0 by default.getUpY()Y of the top of the head, 1 by default.getUpZ()Z of the top of the head, 0 by default.voidsetOrientation(float fx, float fy, float fz, float ux, float uy, float uz) Turns the listener now.voidsetPosition(float x, float y, float z) Moves the listener now.
-
Method Details
-
setPosition
public void setPosition(float x, float y, float z) Moves the listener now.
Parameters
-
x: position on X -
y: position on Y -
z: position on Z
-
-
setOrientation
public void setOrientation(float fx, float fy, float fz, float ux, float uy, float uz) Turns the listener now.
Parameters
-
fx: forward X -
fy: forward Y -
fz: forward Z -
ux: up X -
uy: up Y -
uz: up Z
-
-
getPositionX
Position on X, 0 by default.
Returns
the parameter
-
getPositionY
Position on Y, 0 by default.
Returns
the parameter
-
getPositionZ
Position on Z, 0 by default.
Returns
the parameter
-
getForwardX
X of the direction faced, 0 by default.
Returns
the parameter
-
getForwardY
Y of the direction faced, 0 by default.
Returns
the parameter
-
getForwardZ
Z of the direction faced, -1 by default.
Returns
the parameter
-
getUpX
X of the top of the head, 0 by default.
Returns
the parameter
-
getUpY
Y of the top of the head, 1 by default.
Returns
the parameter
-
getUpZ
Z of the top of the head, 0 by default.
Returns
the parameter
-