AudioManagerPlugin
Defined in: plugins/audio/AudioManagerPlugin.ts:126
AudioManager is a class that manages audio playback in the application. It provides methods to play, stop, fade in/out, and crossfade sounds. It also allows you to create and manage audio channels.
Example
Section titled “Example”const audioManager = new AudioManager();audioManager.play('soundId', 'music');
Extends
Section titled “Extends”Type Parameters
Section titled “Type Parameters”C
extends ChannelName
= ChannelName
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AudioManagerPlugin<
C
>(id
):AudioManagerPlugin
<C
>
Defined in: plugins/audio/AudioManagerPlugin.ts:170
Creates a new AudioManager instance.
Parameters
Section titled “Parameters”string
= 'audio'
The ID of the AudioManager. Default is ‘AudioManager’.
Returns
Section titled “Returns”AudioManagerPlugin
<C
>
Overrides
Section titled “Overrides”Properties
Section titled “Properties”__dill_pixel_method_binding_root
Section titled “__dill_pixel_method_binding_root”__dill_pixel_method_binding_root:
boolean
Defined in: plugins/Plugin.ts:39
Inherited from
Section titled “Inherited from”Plugin
.__dill_pixel_method_binding_root
id:
string
='Plugin'
Defined in: plugins/Plugin.ts:48
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”onChannelMuted
Section titled “onChannelMuted”onChannelMuted:
Signal
<(detail
) =>void
>
Defined in: plugins/audio/AudioManagerPlugin.ts:158
Signal that is emitted when a channel is muted or unmuted. The callback function receives a ChannelMutedDetail object.
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.onChannelMuted
onChannelVolumeChanged
Section titled “onChannelVolumeChanged”onChannelVolumeChanged:
Signal
<(detail
) =>void
>
Defined in: plugins/audio/AudioManagerPlugin.ts:151
Signal that is emitted when a channel’s volume changes. The callback function receives a ChannelVolumeDetail object.
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.onChannelVolumeChanged
onMasterVolumeChanged
Section titled “onMasterVolumeChanged”onMasterVolumeChanged:
Signal
<(volume
) =>void
>
Defined in: plugins/audio/AudioManagerPlugin.ts:146
Signal that is emitted when the master volume changes. The callback function receives the new volume as a number.
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.onMasterVolumeChanged
onMuted
Section titled “onMuted”onMuted:
Signal
<(muted
) =>void
>
Defined in: plugins/audio/AudioManagerPlugin.ts:141
Signal that is emitted when the system is muted or unmuted.
Implementation of
Section titled “Implementation of”onSoundEnded
Section titled “onSoundEnded”onSoundEnded:
Signal
<(detail
) =>void
>
Defined in: plugins/audio/AudioManagerPlugin.ts:137
Signal that is emitted when a sound ends. The callback function receives a SoundDetail object.
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.onSoundEnded
onSoundStarted
Section titled “onSoundStarted”onSoundStarted:
Signal
<(detail
) =>void
>
Defined in: plugins/audio/AudioManagerPlugin.ts:132
Signal that is emitted when a sound starts playing. The callback function receives a SoundDetail object.
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.onSoundStarted
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get app():
A
Defined in: plugins/Plugin.ts:53
Returns
Section titled “Returns”A
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”channels
Section titled “channels”Get Signature
Section titled “Get Signature”get channels():
Map
<string
,IAudioChannel
>
Defined in: plugins/audio/AudioManagerPlugin.ts:222
Gets the map of audio channels.
Returns
Section titled “Returns”Map
<string
, IAudioChannel
>
The map of audio channels.
Implementation of
Section titled “Implementation of”masterVolume
Section titled “masterVolume”Get Signature
Section titled “Get Signature”get masterVolume():
number
Defined in: plugins/audio/AudioManagerPlugin.ts:184
Gets the master volume.
Returns
Section titled “Returns”number
The master volume.
Set Signature
Section titled “Set Signature”set masterVolume(
value
):void
Defined in: plugins/audio/AudioManagerPlugin.ts:192
Sets the master volume.
Parameters
Section titled “Parameters”number
The new master volume.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.masterVolume
Get Signature
Section titled “Get Signature”get music():
IAudioChannel
Defined in: plugins/audio/AudioManagerPlugin.ts:226
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”Get Signature
Section titled “Get Signature”get muted():
boolean
Defined in: plugins/audio/AudioManagerPlugin.ts:203
Gets whether the audio is muted.
Returns
Section titled “Returns”boolean
True if the audio is muted, false otherwise.
Set Signature
Section titled “Set Signature”set muted(
value
):void
Defined in: plugins/audio/AudioManagerPlugin.ts:211
Sets whether the audio is muted.
Parameters
Section titled “Parameters”boolean
True to mute the audio, false to unmute.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”options
Section titled “options”Get Signature
Section titled “Get Signature”get options():
O
Defined in: plugins/Plugin.ts:44
Returns
Section titled “Returns”O
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”paused
Section titled “paused”Get Signature
Section titled “Get Signature”get paused():
boolean
Defined in: plugins/audio/AudioManagerPlugin.ts:335
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”Get Signature
Section titled “Get Signature”get sfx():
IAudioChannel
Defined in: plugins/audio/AudioManagerPlugin.ts:230
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”Get Signature
Section titled “Get Signature”get vo():
IAudioChannel
Defined in: plugins/audio/AudioManagerPlugin.ts:238
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”voiceover
Section titled “voiceover”Get Signature
Section titled “Get Signature”get voiceover():
IAudioChannel
Defined in: plugins/audio/AudioManagerPlugin.ts:234
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”add(
soundAsset
):void
Defined in: plugins/audio/AudioManagerPlugin.ts:398
Adds a sound asset to the AudioManager.
Parameters
Section titled “Parameters”soundAsset
Section titled “soundAsset”UnresolvedAsset
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”addAllFromBundle()
Section titled “addAllFromBundle()”addAllFromBundle(
bundleName
,manifest?
):void
Defined in: plugins/audio/AudioManagerPlugin.ts:366
Adds all sound assets from the specified bundle.
Parameters
Section titled “Parameters”bundleName
Section titled “bundleName”string
manifest?
Section titled “manifest?”string
| AssetsManifest
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.addAllFromBundle
addAllFromManifest()
Section titled “addAllFromManifest()”addAllFromManifest(
manifest
):void
Defined in: plugins/audio/AudioManagerPlugin.ts:343
Adds all sound assets from the specified manifest.
Parameters
Section titled “Parameters”manifest
Section titled “manifest”AssetsManifest
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.addAllFromManifest
addSignalConnection()
Section titled “addSignalConnection()”addSignalConnection(…
args
):void
Defined in: plugins/Plugin.ts:79
Add signal connections to the container.
Parameters
Section titled “Parameters”…SignalConnection
[]
The signal connections to add.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.addSignalConnection
Inherited from
Section titled “Inherited from”clearSignalConnections()
Section titled “clearSignalConnections()”clearSignalConnections():
void
Defined in: plugins/Plugin.ts:85
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.clearSignalConnections
Inherited from
Section titled “Inherited from”createChannel()
Section titled “createChannel()”createChannel(
name
):void
Defined in: plugins/audio/AudioManagerPlugin.ts:274
Creates a new audio channel.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.createChannel
crossFade()
Section titled “crossFade()”crossFade(
outSoundId
,inSoundId
,channelName
,duration
):Promise
<null
|Tween
>
Defined in: plugins/audio/AudioManagerPlugin.ts:535
Crossfades between two sounds in the specified channel.
Parameters
Section titled “Parameters”outSoundId
Section titled “outSoundId”string
inSoundId
Section titled “inSoundId”string
channelName
Section titled “channelName”ChannelName
= 'music'
duration
Section titled “duration”number
= 2
Returns
Section titled “Returns”Promise
<null
| Tween
>
Implementation of
Section titled “Implementation of”destroy()
Section titled “destroy()”destroy():
void
Defined in: plugins/audio/AudioManagerPlugin.ts:242
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”fade()
Section titled “fade()”fade(
soundId
,channelName
,props
,stopOnComplete
):Promise
<null
|Tween
>
Defined in: plugins/audio/AudioManagerPlugin.ts:554
Fades a sound with the specified ID in the specified channel.
Parameters
Section titled “Parameters”soundId
Section titled “soundId”string
channelName
Section titled “channelName”ChannelName
= 'music'
TweenVars
stopOnComplete
Section titled “stopOnComplete”boolean
= false
Returns
Section titled “Returns”Promise
<null
| Tween
>
Implementation of
Section titled “Implementation of”fadeIn()
Section titled “fadeIn()”fadeIn(
soundId
,channelName
,props
):Promise
<null
|Tween
>
Defined in: plugins/audio/AudioManagerPlugin.ts:483
Fades in a sound with the specified ID in the specified channel.
Parameters
Section titled “Parameters”soundId
Section titled “soundId”string
channelName
Section titled “channelName”C
= ...
TweenVars
Returns
Section titled “Returns”Promise
<null
| Tween
>
Implementation of
Section titled “Implementation of”fadeOut()
Section titled “fadeOut()”fadeOut(
soundId
,channelName
,props
):Promise
<null
|Tween
>
Defined in: plugins/audio/AudioManagerPlugin.ts:509
Fades out a sound with the specified ID in the specified channel.
Parameters
Section titled “Parameters”soundId
Section titled “soundId”string
channelName
Section titled “channelName”C
= ...
Partial
<gsap.TweenVars
> = ...
Returns
Section titled “Returns”Promise
<null
| Tween
>
Implementation of
Section titled “Implementation of”getAudioInstance()
Section titled “getAudioInstance()”getAudioInstance(
soundId
,channelName
):undefined
|IAudioInstance
<ChannelName
>
Defined in: plugins/audio/AudioManagerPlugin.ts:604
Parameters
Section titled “Parameters”soundId
Section titled “soundId”string
channelName
Section titled “channelName”C
= ...
Returns
Section titled “Returns”undefined
| IAudioInstance
<ChannelName
>
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.getAudioInstance
getChannel()
Section titled “getChannel()”getChannel(
name
):undefined
|IAudioChannel
Defined in: plugins/audio/AudioManagerPlugin.ts:299
Gets the audio channel with the specified name.
Parameters
Section titled “Parameters”C
Returns
Section titled “Returns”undefined
| IAudioChannel
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.getChannel
initialize()
Section titled “initialize()”initialize(
_options
,app
):Promise
<void
>
Defined in: plugins/audio/AudioManagerPlugin.ts:261
Initializes the AudioManager.
Parameters
Section titled “Parameters”_options
Section titled “_options”any
Returns
Section titled “Returns”Promise
<void
>
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.initialize
Overrides
Section titled “Overrides”isPlaying()
Section titled “isPlaying()”isPlaying(
soundId
,channelName
):boolean
Defined in: plugins/audio/AudioManagerPlugin.ts:416
Parameters
Section titled “Parameters”soundId
Section titled “soundId”string
channelName
Section titled “channelName”C
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”load()
Section titled “load()”load(
soundId
,channelName
,options?
):void
Defined in: plugins/audio/AudioManagerPlugin.ts:614
Parameters
Section titled “Parameters”soundId
Section titled “soundId”string
| string
[]
channelName
Section titled “channelName”C
= ...
options?
Section titled “options?”PlayOptions
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”mute()
Section titled “mute()”mute():
void
Defined in: plugins/audio/AudioManagerPlugin.ts:306
Mutes the audio.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”pause()
Section titled “pause()”pause():
void
Defined in: plugins/audio/AudioManagerPlugin.ts:322
Pauses the audio.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”play()
Section titled “play()”play(
soundId
,channelName
,options?
):Promise
<IAudioInstance
<ChannelName
>>
Defined in: plugins/audio/AudioManagerPlugin.ts:431
Plays a sound with the specified ID in the specified channel.
Parameters
Section titled “Parameters”soundId
Section titled “soundId”string
channelName
Section titled “channelName”C
= ...
options?
Section titled “options?”PlayOptions
Returns
Section titled “Returns”Promise
<IAudioInstance
<ChannelName
>>
Implementation of
Section titled “Implementation of”postInitialize()
Section titled “postInitialize()”postInitialize(
_app
):void
|Promise
<void
>
Defined in: plugins/Plugin.ts:68
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
| Promise
<void
>
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.postInitialize
Inherited from
Section titled “Inherited from”restore()
Section titled “restore()”restore():
Promise
<void
>
Defined in: plugins/audio/AudioManagerPlugin.ts:580
Restores the audio state after it has been suspended.
Returns
Section titled “Returns”Promise
<void
>
Implementation of
Section titled “Implementation of”resume()
Section titled “resume()”resume():
void
Defined in: plugins/audio/AudioManagerPlugin.ts:330
Resumes the audio.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setChannelVolume()
Section titled “setChannelVolume()”setChannelVolume(
channelName
,volume
):void
Defined in: plugins/audio/AudioManagerPlugin.ts:287
Sets the volume of the specified channel.
Parameters
Section titled “Parameters”channelName
Section titled “channelName”C
| C
[]
volume
Section titled “volume”number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IAudioManagerPlugin
.setChannelVolume
stop()
Section titled “stop()”stop(
soundId
,channelName
):undefined
|IAudioInstance
<ChannelName
>
Defined in: plugins/audio/AudioManagerPlugin.ts:467
Stops a sound with the specified ID in the specified channel.
Parameters
Section titled “Parameters”soundId
Section titled “soundId”string
channelName
Section titled “channelName”C
= ...
Returns
Section titled “Returns”undefined
| IAudioInstance
<ChannelName
>
Implementation of
Section titled “Implementation of”stopAll()
Section titled “stopAll()”stopAll(
fade
,duration
,props
):void
Defined in: plugins/audio/AudioManagerPlugin.ts:637
Parameters
Section titled “Parameters”boolean
= false
duration
Section titled “duration”number
= 1
TweenVars
= {}
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”suspend()
Section titled “suspend()”suspend():
void
Defined in: plugins/audio/AudioManagerPlugin.ts:598
Suspends the audio by setting the master volume to 0 and pausing all sounds.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”unmute()
Section titled “unmute()”unmute():
void
Defined in: plugins/audio/AudioManagerPlugin.ts:314
Unmutes the audio.
Returns
Section titled “Returns”void