melonJS
    Preparing search index...

    Function listener

    Get or set the listener's position, in WORLD coordinates.

    Called with no arguments it reads the position back. Called with coordinates it moves the listener, which is what makes a sound at a fixed world point pan and fade as the player moves past it.

    The listener starts at the origin and stays there until something moves it, so a game that never calls this sounds exactly as it did before.

    world x, or omitted to read

    world y, measured DOWN like every other melonJS coordinate

    world z, defaulting to 0

    the current [x, y, z] when reading, otherwise nothing

    // follow the player by hand, if `setListener` is not wanted
    audio.listener(player.pos.x, player.pos.y);