new SoundManager(viewer)
A FORGE.SoundManager is an object to manage all sounds.
Parameters:
Name | Type | Description |
---|---|---|
viewer |
FORGE.Viewer | The FORGE.Viewer reference. |
- Source:
- To Do:
-
- Start/Stop sound to avoid autoplay
Extends
Members
(readonly) alive :boolean
Get the alive flag value of the object.
Type:
- boolean
- Inherited From:
- Source:
(readonly, nullable) analyser :AnalyserNode
Get the analyser.
Type:
- AnalyserNode
- Source:
(readonly) className :string
Get the class name of the object.
Type:
- string
- Inherited From:
- Source:
(readonly, nullable) context :AudioContext
Get the audio context.
Type:
- AudioContext
- 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:
enabled :boolean
Get the enabled state for sounds.
Type:
- boolean
- Source:
(readonly, nullable) inputNode :AudioDestinationNode
Get the analyser
Type:
- AudioDestinationNode
- Source:
(readonly, nullable) masterGain :GainNode
Get the masterGain.
Type:
- GainNode
- Source:
muted :boolean
Get or set the muted state for sounds.
Type:
- boolean
- 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:
onDisable :FORGE.EventDispatcher
Get the sounds "onDisable" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onDisable :FORGE.EventDispatcher
Get the sounds "onEnable" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onMute :FORGE.EventDispatcher
Get the sounds "onMute" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onUnmute :FORGE.EventDispatcher
Get the sounds "onUnmute" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- Source:
onVolumeChange :FORGE.EventDispatcher
Get the sounds "onVolumeChange" event FORGE.EventDispatcher.
The FORGE.EventDispatcher is created only if you ask for it.
Type:
- 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:
(readonly) useAudioTag :boolean
The Audio tag must be used?
Type:
- boolean
- Source:
(readonly) useWebAudio :boolean
The WebAudio API tag must be used?
Type:
- boolean
- Source:
volume :number
Get or set the global volume for sounds.
Type:
- number
- Source:
warning :boolean
Get and set the warning flag.
Type:
- boolean
- Inherited From:
- Source:
Methods
add(sound)
Add a FORGE.Sound into the _sounds Array.
Parameters:
Name | Type | Description |
---|---|---|
sound |
FORGE.Sound | The FORGE.Sound to add. |
- Source:
addConfig(config)
Add a sound config to the manager.
Parameters:
Name | Type | Description |
---|---|---|
config |
AudioConfig | The config you want to add. |
- Source:
destroy()
Destroy sequence
- 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 sounds.
- Source:
pauseAll()
Pause all playing sounds.
- Source:
remove(sound)
Remove a FORGE.Sound into the _sounds Array.
Parameters:
Name | Type | Description |
---|---|---|
sound |
FORGE.Sound | The FORGE.Sound to remove. |
- Source:
resume()
Resume the audio context if at least one sound is playing.
- Source:
resumeAll()
Play all sounds that have been paused with the pauseAll method.
- Source:
suspend()
Suspend audio context if no sound are playing.
- Source:
unmute()
Unmute method of the sounds.
- 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: