Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class AudioListener

  1. Object
  2. 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.

Methods

public void setPosition(float x, float y, float z)Moves the listener now.
public void setOrientation(float fx, float fy, float fz, float ux, float uy, float uz)Turns the listener now.
public AudioParam getPositionX()Position on X, 0 by default.
public AudioParam getPositionY()Position on Y, 0 by default.
public AudioParam getPositionZ()Position on Z, 0 by default.
public AudioParam getForwardX()X of the direction faced, 0 by default.
public AudioParam getForwardY()Y of the direction faced, 0 by default.
public AudioParam getForwardZ()Z of the direction faced, -1 by default.
public AudioParam getUpX()X of the top of the head, 0 by default.
public AudioParam getUpY()Y of the top of the head, 1 by default.
public AudioParam getUpZ()Z of the top of the head, 0 by default.

Inherited methods

Method details

setPosition

public void setPosition(float x, float y, float z)
Moves the listener now.

Parameters

x float
position on X
y float
position on Y
z float
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 float
forward X
fy float
forward Y
fz float
forward Z
ux float
up X
uy float
up Y
uz float
up Z

getPositionX

public AudioParam getPositionX()
Position on X, 0 by default.

Returns

the parameter

getPositionY

public AudioParam getPositionY()
Position on Y, 0 by default.

Returns

the parameter

getPositionZ

public AudioParam getPositionZ()
Position on Z, 0 by default.

Returns

the parameter

getForwardX

public AudioParam getForwardX()
X of the direction faced, 0 by default.

Returns

the parameter

getForwardY

public AudioParam getForwardY()
Y of the direction faced, 0 by default.

Returns

the parameter

getForwardZ

public AudioParam getForwardZ()
Z of the direction faced, -1 by default.

Returns

the parameter

getUpX

public AudioParam getUpX()
X of the top of the head, 0 by default.

Returns

the parameter

getUpY

public AudioParam getUpY()
Y of the top of the head, 1 by default.

Returns

the parameter

getUpZ

public AudioParam getUpZ()
Z of the top of the head, 0 by default.

Returns

the parameter