Class AudioListener
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The AudioListener interface represents the position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. All PannerNodes spatialize in relation to the AudioListener stored in the Listener attribute.
[Value("AudioListener")]
public class AudioListener
- Inheritance
-
AudioListener
- Inherited Members
Remarks
It is important to note that there is only one listener per context and that it isn't an AudioNode.
Constructors
AudioListener()
public AudioListener()
Properties
ForwardX
The forwardX read-only property of the AudioListener interface is an AudioParam representing the x value of the direction vector defining the forward direction the listener is pointing in.
[Value("forwardX")]
public AudioParam ForwardX { get; }
Property Value
- AudioParam
An AudioParam. Its default value is 0, and it can range between positive and negative infinity.
Remarks
NOTE
The parameter is a-rate when used with a PannerNode whose PanningModel is set to equalpower, or k-rate otherwise.
ForwardY
The forwardY read-only property of the AudioListener interface is an AudioParam representing the y value of the direction vector defining the forward direction the listener is pointing in.
[Value("forwardY")]
public AudioParam ForwardY { get; }
Property Value
- AudioParam
An AudioParam. Its default value is 0, and it can range between positive and negative infinity.
Remarks
NOTE
The parameter is a-rate when used with a PannerNode whose PanningModel is set to equalpower, or k-rate otherwise.
ForwardZ
The forwardZ read-only property of the AudioListener interface is an AudioParam representing the z value of the direction vector defining the forward direction the listener is pointing in.
[Value("forwardZ")]
public AudioParam ForwardZ { get; }
Property Value
- AudioParam
An AudioParam. Its default value is -1, and it can range between positive and negative infinity.
Remarks
NOTE
The parameter is a-rate when used with a PannerNode whose PanningModel is set to equalpower, or k-rate otherwise.
PositionX
The positionX read-only property of the AudioListener interface is an AudioParam representing the x position of the listener in 3D cartesian space.
[Value("positionX")]
public AudioParam PositionX { get; }
Property Value
- AudioParam
An AudioParam. Its default value is 0, and it can range between positive and negative infinity.
Remarks
NOTE
The parameter is a-rate when used with a PannerNode whose PanningModel is set to equalpower, or k-rate otherwise.
PositionY
The positionY read-only property of the AudioListener interface is an AudioParam representing the y position of the listener in 3D cartesian space.
[Value("positionY")]
public AudioParam PositionY { get; }
Property Value
- AudioParam
An AudioParam. Its default value is 0, and it can range between positive and negative infinity.
Remarks
NOTE
The parameter is a-rate when used with a PannerNode whose PanningModel is set to equalpower, or k-rate otherwise.
PositionZ
The positionZ read-only property of the AudioListener interface is an AudioParam representing the z position of the listener in 3D cartesian space.
[Value("positionZ")]
public AudioParam PositionZ { get; }
Property Value
- AudioParam
An AudioParam. Its default value is 0, and it can range between positive and negative infinity.
Remarks
NOTE
The parameter is a-rate when used with a PannerNode whose PanningModel is set to equalpower, or k-rate otherwise.
UpX
The upX read-only property of the AudioListener interface is an AudioParam representing the x value of the direction vector defining the up direction the listener is pointing in.
[Value("upX")]
public AudioParam UpX { get; }
Property Value
- AudioParam
An AudioParam. Its default value is 0, and it can range between positive and negative infinity.
Remarks
NOTE
The parameter is a-rate when used with a PannerNode whose PanningModel is set to equalpower, or k-rate otherwise.
UpY
The upY read-only property of the AudioListener interface is an AudioParam representing the y value of the direction vector defining the up direction the listener is pointing in.
[Value("upY")]
public AudioParam UpY { get; }
Property Value
- AudioParam
An AudioParam. Its default value is 1, and it can range between positive and negative infinity.
Remarks
NOTE
The parameter is a-rate when used with a PannerNode whose PanningModel is set to equalpower, or k-rate otherwise.
UpZ
The upZ read-only property of the AudioListener interface is an AudioParam representing the z value of the direction vector defining the up direction the listener is pointing in.
[Value("upZ")]
public AudioParam UpZ { get; }
Property Value
- AudioParam
An AudioParam. Its default value is 0, and it can range between positive and negative infinity.
Remarks
NOTE
The parameter is a-rate when used with a PannerNode whose PanningModel is set to equalpower, or k-rate otherwise.
Methods
SetOrientation(Number, Number, Number, Number, Number, Number)
IMPORTANT
DeprecatedsetOrientation() method of the AudioListener interface defines the orientation of the listener.
[Value("setOrientation")]
public GlobalObject.Undefined SetOrientation(Number x, Number y, Number z, Number xUp, Number yUp, Number zUp)
Parameters
Returns
Remarks
It consists of two direction vectors:
The two vectors must be separated by an angle of 90° — in linear analysis terms, they must be perpendicular to each other.
SetPosition(Number, Number, Number)
IMPORTANT
DeprecatedsetPosition() method of the AudioListener Interface defines the position of the listener.
[Value("setPosition")]
public GlobalObject.Undefined SetPosition(Number x, Number y, Number z)
Parameters
Returns
Remarks
The three parameters x, y and z are unitless and describe the listener's position in 3D space according to the right-hand Cartesian coordinate system. PannerNode objects use this position relative to individual audio sources for spatialization.
The default value of the position vector is (0, 0, 0).
NOTE
As this method is deprecated, use the three PositionX, PositionY, and PositionZ properties instead.