Class: AudioListener
Defined in: src/sound/AudioListener.ts:22
Extends
Constructors
Constructor
new AudioListener(
options):AudioListener
Defined in: src/sound/AudioListener.ts:38
Parameters
options
AudioListenerOptions = {}
Returns
AudioListener
Overrides
Properties
aiService?
optionalaiService:AI
Defined in: src/sound/AudioListener.ts:34
audioContext?
optionalaudioContext:AudioContext
Defined in: src/sound/AudioListener.ts:26
isXRScript
isXRScript:
boolean=true
Defined in: src/core/Script.ts:100
Inherited from
xb?
optionalxb:XBObjectOptions
Defined in: src/interaction/InteractionTypes.ts:34
Inherited from
dependencies
staticdependencies:object
Defined in: src/sound/AudioListener.ts:23
registry
registry: typeof
Registry=Registry
Methods
cleanup()
cleanup():
void
Defined in: src/sound/AudioListener.ts:177
Returns
void
clearAccumulatedBuffer()
clearAccumulatedBuffer():
void
Defined in: src/sound/AudioListener.ts:237
Clears accumulated chunks
Returns
void
clearLatestAudioBuffer()
clearLatestAudioBuffer():
void
Defined in: src/sound/AudioListener.ts:208
Returns
void
dispose()
dispose():
void
Defined in: src/sound/AudioListener.ts:248
Called when the script is removed from the scene. Opposite of init.
Returns
void
Overrides
getAccumulatedBuffer()
getAccumulatedBuffer():
ArrayBuffer|null
Defined in: src/sound/AudioListener.ts:215
Gets all accumulated audio chunks as a single combined buffer
Returns
ArrayBuffer | null
getAccumulatedChunkCount()
getAccumulatedChunkCount():
number
Defined in: src/sound/AudioListener.ts:244
Gets the number of accumulated chunks
Returns
number
getIsCapturing()
getIsCapturing():
boolean
Defined in: src/sound/AudioListener.ts:200
Returns
boolean
getLatestAudioBuffer()
getLatestAudioBuffer():
ArrayBuffer|null
Defined in: src/sound/AudioListener.ts:204
Returns
ArrayBuffer | null
init()
init(
__namedParameters):void
Defined in: src/sound/AudioListener.ts:53
Init the AudioListener.
Parameters
__namedParameters
registry
Returns
void
Overrides
initPhysics()
initPhysics(
_physics):void|Promise<void>
Defined in: src/core/Script.ts:119
Enables depth-aware interactions with physics. See /samples/advanced/ballpit
Parameters
_physics
Returns
void | Promise<void>
Inherited from
onHoverEnter()
onHoverEnter(
_event):void
Defined in: src/core/Script.ts:222
Called when a source starts hovering over this object.
Parameters
_event
The hover source, target, surface, and intersection.
Call event.stopPropagation() to stop bubbling to ancestor Scripts.
Returns
void
Inherited from
onHoverExit()
onHoverExit(
_event):void
Defined in: src/core/Script.ts:228
Called when a source stops hovering over this object.
Parameters
_event
The hover source, target, surface, and intersection.
Call event.stopPropagation() to stop bubbling to ancestor Scripts.
Returns
void
Inherited from
onHovering()
onHovering(
_event):void
Defined in: src/core/Script.ts:234
Called while a source hovers over this object.
Parameters
_event
The hover source, target, surface, and intersection.
Call event.stopPropagation() to stop bubbling to ancestor Scripts.
Returns
void
Inherited from
onKeyDown()
onKeyDown(
_event):void
Defined in: src/core/Script.ts:159
Called on keyboard keypress.
Parameters
_event
Event containing .code to read the keyboard key.
Returns
void
Inherited from
onKeyUp()
onKeyUp(
_event):void
Defined in: src/core/Script.ts:160
Parameters
_event
Returns
void
Inherited from
onLongSelect()
onLongSelect(
_event):void
Defined in: src/core/Script.ts:153
Called when an object selection reaches the long-select delay.
Parameters
_event
Returns
void
Inherited from
onObjectGrabbing()
onObjectGrabbing(
_event):void
Defined in: src/core/Script.ts:260
Called every frame a hand is grabbing this object.
Parameters
_event
Returns
void
Inherited from
onObjectGrabEnd()
onObjectGrabEnd(
_event):void
Defined in: src/core/Script.ts:265
Called when a hand stops grabbing this object. This ends built-in direct-touch manipulation without ending contact.
Parameters
_event
Returns
void
Inherited from
onObjectGrabStart()
onObjectGrabStart(
_event):void
Defined in: src/core/Script.ts:256
Called when a hand starts grabbing this object (touching + pinching). A grab starts built-in direct-touch manipulation when enabled.
Parameters
_event
Returns
void
Inherited from
onObjectLongSelect()
onObjectLongSelect(
_event):void
Defined in: src/core/Script.ts:210
Called once when a captured selection is held for the long-select delay. Manipulation captures do not emit this callback.
Parameters
_event
The controller and completed hold duration.
Call event.stopPropagation() to stop bubbling to ancestor Scripts.
Call event.stopGlobalPropagation() to suppress global selection callbacks
for the rest of this capture
Returns
void
Inherited from
onObjectManipulate()
onObjectManipulate(
_event):void
Defined in: src/core/Script.ts:216
Called for each phase of an automatic object manipulation. Call
event.stopPropagation() to stop bubbling. Calling preventDefault()
on a start event suppresses the automatic action.
Parameters
_event
Returns
void
Inherited from
onObjectSelectEnd()
onObjectSelectEnd(
_event):void
Defined in: src/core/Script.ts:201
Called when a source stops selecting the object this Script represents.
Parameters
_event
The completed state and end reason.
Call event.stopPropagation() to stop bubbling to ancestor Scripts.
Call event.stopGlobalPropagation() to suppress global selection callbacks
for the rest of this capture
Returns
void
Inherited from
onObjectSelectStart()
onObjectSelectStart(
_event):void
Defined in: src/core/Script.ts:193
Called when a source starts selecting the object this Script represents.
Parameters
_event
event.target is the logical object and
event.source.controller identifies the controller.
Call event.stopPropagation() to stop bubbling to ancestor Scripts.
Call event.stopGlobalPropagation() to suppress global selection callbacks
for the rest of this capture
Returns
void
Inherited from
onObjectTouchEnd()
onObjectTouchEnd(
_event):void
Defined in: src/core/Script.ts:251
Called when a hand's index finger stops touching this object. This ends the default selection lifecycle after the touch callback.
Parameters
_event
Returns
void
Inherited from
onObjectTouching()
onObjectTouching(
_event):void
Defined in: src/core/Script.ts:246
Called every frame that a hand's index finger is touching this object. The object remains selected during these frames unless touch selection was prevented when contact started.
Parameters
_event
Returns
void
Inherited from
onObjectTouchStart()
onObjectTouchStart(
_event):void
Defined in: src/core/Script.ts:240
Called when a hand's index finger starts touching this object.
Direct touch starts the object's selection lifecycle by default. Call
event.preventDefault() to handle contact without selecting.
Parameters
_event
Returns
void
Inherited from
onSelect()
onSelect(
_event):void
Defined in: src/core/Script.ts:145
Called whenever pinch / mouse click successfully completes, globally.
Parameters
_event
The interaction source and completed target.
Returns
void
Inherited from
onSelectEnd()
onSelectEnd(
_event):void
Defined in: src/core/Script.ts:139
Called whenever pinch / mouse click discontinues, globally.
Parameters
_event
The completed state and end reason.
Returns
void
Inherited from
onSelecting()
onSelecting(
_event):void
Defined in: src/core/Script.ts:150
Called whenever pinch / mouse click is happening, globally.
Parameters
_event
Returns
void
Inherited from
onSelectStart()
onSelectStart(
_event):void
Defined in: src/core/Script.ts:133
Called whenever pinch / mouse click starts, globally.
Parameters
_event
The interaction source and optional captured target.
Returns
void
Inherited from
onSimulatorStarted()
onSimulatorStarted():
void
Defined in: src/core/Script.ts:125
Returns
void
Inherited from
onSqueeze()
onSqueeze(
_event):void
Defined in: src/core/Script.ts:182
Called whenever gamepad trigger successfully completes, globally.
Parameters
_event
event.source.controller identifies the controller.
Returns
void
Inherited from
onSqueezeEnd()
onSqueezeEnd(
_event):void
Defined in: src/core/Script.ts:171
Called whenever gamepad trigger stops, globally.
Parameters
_event
event.source.controller identifies the controller.
Returns
void
Inherited from
onSqueezeStart()
onSqueezeStart(
_event):void
Defined in: src/core/Script.ts:166
Called whenever gamepad trigger starts, globally.
Parameters
_event
event.source.controller identifies the controller.
Returns
void
Inherited from
onSqueezing()
onSqueezing(
_event):void
Defined in: src/core/Script.ts:176
Called whenever gamepad is being triggered, globally.
Parameters
_event
Returns
void
Inherited from
onXRSessionEnded()
onXRSessionEnded():
void
Defined in: src/core/Script.ts:123
Returns
void
Inherited from
onXRSessionStarted()
onXRSessionStarted(
_session?):void
Defined in: src/core/Script.ts:122
Parameters
_session?
Returns
void
Inherited from
physicsStep()
physicsStep():
void
Defined in: src/core/Script.ts:120
Returns
void
Inherited from
setAIStreaming()
setAIStreaming(
enabled):void
Defined in: src/sound/AudioListener.ts:173
Parameters
enabled
boolean
Returns
void
setupAudioCapture()
setupAudioCapture():
Promise<void>
Defined in: src/sound/AudioListener.ts:89
Returns
Promise<void>
startCapture()
startCapture(
callbacks):Promise<void>
Defined in: src/sound/AudioListener.ts:57
Parameters
callbacks
accumulate?
boolean
onAudioData?
(audioBuffer) => void
onError?
(error) => void
Returns
Promise<void>
stopCapture()
stopCapture():
void
Defined in: src/sound/AudioListener.ts:83
Returns
void
streamToAI()
streamToAI(
audioBuffer):void
Defined in: src/sound/AudioListener.ts:160
Parameters
audioBuffer
Returns
void
update()
update(
_time?,_frame?):void
Defined in: src/core/Script.ts:114
Runs per frame.
Parameters
_time?
number
_frame?
Returns
void
Inherited from
isSupported()
staticisSupported():boolean
Defined in: src/sound/AudioListener.ts:196
Returns
boolean