Class: CoreSound
Defined in: src/sound/CoreSound.ts:15
Extends
Constructors
Constructor
new CoreSound():
CoreSound
Defined in: node_modules/@types/three/src/core/Object3D.d.ts:98
This creates a new Object3D object.
Returns
CoreSound
Inherited from
Properties
audioListener
audioListener:
AudioListener
Defined in: src/sound/CoreSound.ts:26
audioPlayer
audioPlayer:
AudioPlayer
Defined in: src/sound/CoreSound.ts:27
backgroundMusic
backgroundMusic:
BackgroundMusic
Defined in: src/sound/CoreSound.ts:22
categoryVolumes
categoryVolumes:
CategoryVolumes
Defined in: src/sound/CoreSound.ts:19
isXRScript
isXRScript:
boolean=true
Defined in: src/core/Script.ts:99
Inherited from
listener
listener:
AudioListener
Defined in: src/sound/CoreSound.ts:21
name
name:
string='Core Sound'
Defined in: src/sound/CoreSound.ts:18
Optional name of the object
Remarks
(doesn't need to be unique).
Default Value
""
Overrides
Script.name
options
options:
SoundOptions
Defined in: src/sound/CoreSound.ts:28
soundSynthesizer
soundSynthesizer:
SoundSynthesizer
Defined in: src/sound/CoreSound.ts:20
spatialAudio
spatialAudio:
SpatialAudio
Defined in: src/sound/CoreSound.ts:23
speechRecognizer?
optionalspeechRecognizer:SpeechRecognizer
Defined in: src/sound/CoreSound.ts:24
speechSynthesizer?
optionalspeechSynthesizer:SpeechSynthesizer
Defined in: src/sound/CoreSound.ts:25
type
type:
string='CoreSound'
Defined in: src/sound/CoreSound.ts:17
A Read-only string to check this object type.
Remarks
This can be used to find a specific type of Object3D in a scene. Sub-classes will update this value.
Default Value
Object3D
Overrides
Script.type
xb?
optionalxb:XBObjectOptions
Defined in: src/interaction/InteractionTypes.ts:32
Inherited from
dependencies
staticdependencies:object
Defined in: src/sound/CoreSound.ts:16
camera
camera: typeof
Camera=THREE.Camera
soundOptions
soundOptions: typeof
SoundOptions=SoundOptions
Methods
clearLatestAudioBuffer()
clearLatestAudioBuffer():
void
Defined in: src/sound/CoreSound.ts:213
Returns
void
clearRecordedBuffer()
clearRecordedBuffer():
void
Defined in: src/sound/CoreSound.ts:141
Clears the accumulated recording buffer
Returns
void
destroy()
destroy():
void
Defined in: src/sound/CoreSound.ts:229
Returns
void
disableAudio()
disableAudio():
void
Defined in: src/sound/CoreSound.ts:111
Returns
void
dispose()
dispose():
void
Defined in: src/core/Script.ts:263
Called when the script is removed from the scene. Opposite of init.
Returns
void
Inherited from
enableAudio()
enableAudio(
options):Promise<void>
Defined in: src/sound/CoreSound.ts:99
Parameters
options
accumulate?
boolean
streamToAI?
boolean
Returns
Promise<void>
getAudioListener()
getAudioListener():
AudioListener
Defined in: src/sound/CoreSound.ts:68
Returns
getCategoryVolume()
getCategoryVolume(
category):number
Defined in: src/sound/CoreSound.ts:93
Parameters
category
Returns
number
getEffectiveVolume()
getEffectiveVolume(
category,specificVolume):number
Defined in: src/sound/CoreSound.ts:217
Parameters
category
specificVolume
number = 1.0
Returns
number
getLatestAudioBuffer()
getLatestAudioBuffer():
ArrayBuffer|null
Defined in: src/sound/CoreSound.ts:209
Returns
ArrayBuffer | null
getMasterVolume()
getMasterVolume():
number
Defined in: src/sound/CoreSound.ts:77
Returns
number
getRecordedBuffer()
getRecordedBuffer():
ArrayBuffer|null
Defined in: src/sound/CoreSound.ts:134
Gets the accumulated recording buffer without stopping
Returns
ArrayBuffer | null
getRecordingSampleRate()
getRecordingSampleRate():
number
Defined in: src/sound/CoreSound.ts:148
Gets the sample rate being used for recording
Returns
number
init()
init(
__namedParameters):void
Defined in: src/sound/CoreSound.ts:30
Initializes an instance with XR controllers, grips, hands, and default options. We allow all scripts to quickly access its user (e.g., user.isSelecting(), user.hands), world (e.g., physical depth mesh, lighting estimation, and recognized objects), and scene (the root of three.js's scene graph). If this returns a promise, we will wait for it.
Parameters
__namedParameters
camera
soundOptions
Returns
void
Overrides
initPhysics()
initPhysics(
_physics):void|Promise<void>
Defined in: src/core/Script.ts:118
Enables depth-aware interactions with physics. See /samples/advanced/ballpit
Parameters
_physics
Returns
void | Promise<void>
Inherited from
isAIAudioPlaying()
isAIAudioPlaying():
boolean
Defined in: src/sound/CoreSound.ts:178
Returns
boolean
isAIStreamingEnabled()
isAIStreamingEnabled():
boolean
Defined in: src/sound/CoreSound.ts:156
Returns
boolean
isAudioEnabled()
isAudioEnabled():
boolean
Defined in: src/sound/CoreSound.ts:205
Returns
boolean
muteAll()
muteAll():
void
Defined in: src/sound/CoreSound.ts:221
Returns
void
onHoverEnter()
onHoverEnter(
_event):void
Defined in: src/core/Script.ts:215
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:221
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:227
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:158
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:159
Parameters
_event
Returns
void
Inherited from
onLongSelect()
onLongSelect(
_event):void
Defined in: src/core/Script.ts:152
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:253
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:258
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:249
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:203
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.
Returns
void
Inherited from
onObjectManipulate()
onObjectManipulate(
_event):void
Defined in: src/core/Script.ts:209
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:196
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.
Returns
void
Inherited from
onObjectSelectStart()
onObjectSelectStart(
_event):void
Defined in: src/core/Script.ts:190
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.
Returns
void
Inherited from
onObjectTouchEnd()
onObjectTouchEnd(
_event):void
Defined in: src/core/Script.ts:244
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:239
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:233
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:144
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:138
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:149
Called whenever pinch / mouse click is happening, globally.
Parameters
_event
Returns
void
Inherited from
onSelectStart()
onSelectStart(
_event):void
Defined in: src/core/Script.ts:132
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:124
Returns
void
Inherited from
onSqueeze()
onSqueeze(
_event):void
Defined in: src/core/Script.ts:181
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:170
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:165
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:175
Called whenever gamepad is being triggered, globally.
Parameters
_event
Returns
void
Inherited from
onXRSessionEnded()
onXRSessionEnded():
void
Defined in: src/core/Script.ts:122
Returns
void
Inherited from
onXRSessionStarted()
onXRSessionStarted(
_session?):void
Defined in: src/core/Script.ts:121
Parameters
_session?
Returns
void
Inherited from
physicsStep()
physicsStep():
void
Defined in: src/core/Script.ts:119
Returns
void
Inherited from
playAIAudio()
playAIAudio(
base64AudioData):Promise<void>
Defined in: src/sound/CoreSound.ts:160
Parameters
base64AudioData
string
Returns
Promise<void>
playRecordedAudio()
playRecordedAudio(
audioBuffer,sampleRate?):Promise<void>
Defined in: src/sound/CoreSound.ts:185
Plays a raw audio buffer (Int16 PCM data) with proper sample rate
Parameters
audioBuffer
sampleRate?
number
Returns
Promise<void>
setAIStreaming()
setAIStreaming(
enabled):void
Defined in: src/sound/CoreSound.ts:152
Parameters
enabled
boolean
Returns
void
setCategoryVolume()
setCategoryVolume(
category,level):void
Defined in: src/sound/CoreSound.ts:83
Parameters
category
level
number
Returns
void
setMasterVolume()
setMasterVolume(
level):void
Defined in: src/sound/CoreSound.ts:72
Parameters
level
number
Returns
void
startRecording()
startRecording():
Promise<void>
Defined in: src/sound/CoreSound.ts:118
Starts recording audio with chunk accumulation
Returns
Promise<void>
stopAIAudio()
stopAIAudio():
void
Defined in: src/sound/CoreSound.ts:174
Returns
void
stopRecording()
stopRecording():
ArrayBuffer|null
Defined in: src/sound/CoreSound.ts:125
Stops recording and returns the accumulated audio buffer
Returns
ArrayBuffer | null
unmuteAll()
unmuteAll():
void
Defined in: src/sound/CoreSound.ts:225
Returns
void
update()
update(
_time?,_frame?):void
Defined in: src/core/Script.ts:113
Runs per frame.
Parameters
_time?
number
_frame?
Returns
void