Class AudioListener

java.lang.Object
com.codename1.media.audio.AudioListener

public final class AudioListener extends Object

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 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

      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