Skip to content

IAudioManager

All audio manager implementations need to implement this interface to function with the framework.

Properties

autoMuteOnVisibilityChange

autoMuteOnVisibilityChange: boolean

Source

src/audio/IAudioManager.ts:7


debug

debug: boolean

Enabling this will print all debug logs.

Source

src/audio/IAudioManager.ts:11


masterVolume

masterVolume: number

The master value that affects all audio.

Source

src/audio/IAudioManager.ts:15

Methods

createAudioTrack()

createAudioTrack(trackId, category): IAudioTrack

Creates an IAudioTrack.

Parameters

trackId: string

The id of the track.

category: string

The category that the track belongs to.

Returns

IAudioTrack

The created IAudioTrack.

Source

src/audio/IAudioManager.ts:100


fadeTo()

fadeTo(trackId, category, volume, milliseconds): void

Fades a track from it’s current volume over time.

Parameters

trackId: string

The id of the track.

category: string

The category that the track belongs to.

volume: number

The volume to fade to.

milliseconds: number

The time in milliseconds it should take to fade.

Returns

void

Source

src/audio/IAudioManager.ts:92


getAudioTrack()

getAudioTrack(trackId, category): undefined | IAudioTrack

Gets a track.

Parameters

trackId: string

The id of the track.

category: string

The category that the track belongs to.

Returns

undefined | IAudioTrack

The IAudioTrack created or undefined if not able to create track. This could happen if the source file could not be found.

Source

src/audio/IAudioManager.ts:109


getCategoryVolume()

getCategoryVolume(category): number

Gets the volume of a specific category.

Parameters

category: string

The category to check.

Returns

number

The volume of the category.

Source

src/audio/IAudioManager.ts:27


getDuration()

getDuration(trackId, category): undefined | number

Gets the length of an IAudioTrack.

Parameters

trackId: string

The id of the track to check.

category: string

The category that the track belongs to.

Returns

undefined | number

The length of the track or undefined if the track doesn’t exist.

Source

src/audio/IAudioManager.ts:42


init()

init(): void

Sets up any listeners that need the entire Application construction to be complete.

Returns

void

Source

src/audio/IAudioManager.ts:20


load()

load(trackIds, category, onLoadCallback?): void

Loads one or more tracks.

Parameters

trackIds: string | string[]

The ids of the tracks to load.

category: string

The category that the track belongs to.

onLoadCallback?

The callback to be called when loading is finished.

Returns

void

Source

src/audio/IAudioManager.ts:75


pause()

pause(trackId, category): undefined | IAudioTrack

Pauses a track.

Parameters

trackId: string

The id of the track.

category: string

The category that the track belongs to.

Returns

undefined | IAudioTrack

Source

src/audio/IAudioManager.ts:60


play()

play(trackId, volume?, loop?, category?, pitch?): undefined | IAudioTrack

Plays a track. If the track does not exist, this function will create it.

Parameters

trackId: string

The id of the track to play.

volume?: number

The volume to play the track at. If this function creates the track, this will be the base volume.

loop?: boolean

Should the track loop or not.

category?: string

The category that the track belongs to.

pitch?: number

the pitch of the track

Returns

undefined | IAudioTrack

The track playing.

Source

src/audio/IAudioManager.ts:53


setCategoryVolume()

setCategoryVolume(category, volume): void

Sets the volume of a specific category.

Parameters

category: string

The category to set.

volume: number

The volume to set.

Returns

void

Source

src/audio/IAudioManager.ts:34


stop()

stop(trackId, category): undefined | IAudioTrack

Stops a track.

Parameters

trackId: string

The id of the track.

category: string

The category that the track belongs to.

Returns

undefined | IAudioTrack

Source

src/audio/IAudioManager.ts:67


unload()

unload(trackId, category, removeTrack): void

Unloads a track’s source from memory.

Parameters

trackId: string

The id of the track.

category: string

The category that the track belongs to.

removeTrack: boolean

Whether the IAudioTrack should be removed and destroyed too.

Returns

void

Source

src/audio/IAudioManager.ts:83