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.
Param: x
world x, or omitted to read
Param: y
world y, measured DOWN like every other melonJS coordinate
Param: z
world z, defaulting to 0
Returns
the current [x, y, z] when reading, otherwise nothing
Example
// follow the player by hand, if `setListener` is not wanted audio.listener(player.pos.x, player.pos.y);
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.
Param: x
world x, or omitted to read
Param: y
world y, measured DOWN like every other melonJS coordinate
Param: z
world z, defaulting to 0
Returns
the current
[x, y, z]when reading, otherwise nothingExample