new Sound(viewer, key, url, ambisonicopt)
A FORGE.Sound is an object that manages a sound.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
viewer |
FORGE.Viewer | The FORGE.Viewer reference. | |
key |
string | The sound file id reference. | |
url |
string | The sound file url. | |
ambisonic |
boolean |
<optional> |
Is the sound ambisonic and need binaural rendering? |
- Source:
- To Do:
-
- Ability to force audio type into config
- Make a test plugin that creates sound, add sound to the PluginObjectFactory
- Loop during x steps (parameter) only if loop is true
Extends
Members
(readonly) alive :boolean
Get the alive flag value of the object.
Type:
- boolean
- Inherited From:
- Source:
ambisonic :boolean
Get the ambisonic state of the sound.
Type:
- boolean
- Source:
(readonly) className :string
Get the class name of the object.
Type:
- string
- Inherited From:
- Source:
currentTime :number
Get or set the current time in milliseconds of the sound.
Type:
- number
- Source:
data :*
Get and set any custom data you want to associate to this object.
Type:
- *
- Inherited From:
- Source:
debug :boolean
Get and set the debug flag.
Type:
- boolean
- Inherited From:
- Source:
(readonly) decoded :boolean
Get the decoded status of the sound.
Type:
- boolean
- Source:
(readonly) duration :number
Get the duration in seconds of the sound.
Type:
- number
- Source:
enabled :boolean
Get and set the sound enabled status.
Type:
- boolean
- Source:
loop :boolean
Get and set the loop status of the sound.
Type:
- boolean
- Source:
muted :boolean
Get or set the muted state of the sound.
Type:
- boolean
- Source:
onCanPlay :FORGE.EventDispatcher
Get the sound "onCanPlay" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onCanPlayThrough :FORGE.EventDispatcher
Get the sound "onCanPlayThrough" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
(readonly) onDestroy :FORGE.EventDispatcher
Get the onDestroy FORGE.EventDispatcher, this event is emitted at the end of the destroy sequence.
Type:
- Inherited From:
- Source:
onEnded :FORGE.EventDispatcher
Get the sound "onEnded" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onLoadedData :FORGE.EventDispatcher
Get the sound "onLoadedData" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onLoadStart :FORGE.EventDispatcher
Get the sound "onLoadStart" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onMute :FORGE.EventDispatcher
Get the sound "onMute" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onPause :FORGE.EventDispatcher
Get the sound "onPause" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onPlay :FORGE.EventDispatcher
Get the sound "onPlay" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onResume :FORGE.EventDispatcher
Get the sound "onResume" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onSoundDecode :FORGE.EventDispatcher
Get the sound "onSoundDecode" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onStop :FORGE.EventDispatcher
Get the sound "onStop" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onUnmute :FORGE.EventDispatcher
Get the sound "onUnmute" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onVolumeChange :FORGE.EventDispatcher
Get the sound "onVolumeChange" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
(readonly) paused :boolean
Get the paused status of the sound.
Type:
- boolean
- Source:
(readonly) playCount :boolean
Get the number of play of the sound.
Type:
- boolean
- Source:
(readonly) playing :boolean
Get the playing status of the sound.
Type:
- boolean
- Source:
(readonly) ready :boolean
Get the ready status of the sound.
Type:
- boolean
- Source:
resumed :boolean
Get/Set the resumed status of the sound.
Type:
- boolean
- Source:
spatialized :boolean
Get or set the spatialized state of the sound.
Type:
- boolean
- Source:
(readonly) tags :Array
Get the tags associated to this object.
Type:
- Array
- Inherited From:
- Source:
(readonly) uid :string
Get the uid of the object.
Type:
- string
- Inherited From:
- Source:
warning :boolean
Get and set the warning flag.
Type:
- boolean
- Inherited From:
- Source:
x :number
Get and set the x axis position of the sound.
Type:
- number
- Source:
y :number
Get and set the y axis position of the sound.
Type:
- number
- Source:
z :number
Get and set the z axis position of the sound.
Type:
- number
- Source:
Methods
destroy()
Augmented destroy method.
- Overrides:
- Source:
log(value)
Basic log method, log a string in the console if debug is enabled.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | The value you want to log in the console. |
- Inherited From:
- Source:
mute()
Mute method of the sound.
- Source:
pause()
Pause method of the sound.
- Source:
play(positionopt, loopopt, nullable, forceRestartopt, nullable)
Play method of the sound.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
position |
number |
<optional> |
The start position to play the sound in milliseconds. |
loop |
boolean |
<optional> <nullable> |
The loop state of the sound. |
forceRestart |
boolean |
<optional> <nullable> |
If the sound is already playing you can set forceRestart to restart it from the beginning. |
- Source:
resume()
Resume method of the sound.
- Source:
stop(internalopt)
Stop method of the sound.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
internal |
boolean |
<optional> |
Internal use: true prevents event firing. |
- Source:
unmute()
Unmute method of the sound.
- Source:
update()
Update method called by the viewer main loop.
- Source:
warn(valuenullable)
Basic warn method, log a warn string in the console if warning is enabled.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
string | Object |
<nullable> |
The value you want to warn in the console. |
- Inherited From:
- Source: