Skip to content

HowlerManager

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

Implements

Constructors

new HowlerManager()

new HowlerManager(app): HowlerManager

Parameters

app: Application<any>

Returns

HowlerManager

Source

src/audio/HowlerManager.ts:144

Properties

autoMuteOnVisibilityChange

autoMuteOnVisibilityChange: boolean = true

Implementation of

IAudioManager.autoMuteOnVisibilityChange

Source

src/audio/HowlerManager.ts:116

Accessors

debug

set debug(pEnabled): void

Enabling this will print all debug logs.

Parameters

pEnabled: boolean

Source

src/audio/HowlerManager.ts:161


masterVolume

get masterVolume(): number

The master value that affects all audio.

set masterVolume(pVolume): void

The master value that affects all audio.

Parameters

pVolume: number

Returns

number

Source

src/audio/HowlerManager.ts:165

Methods

createAudioTrack()

createAudioTrack(trackId, category, volume, loop): IAudioTrack

Creates an IAudioTrack.

Parameters

trackId: string

The id of the track.

category: string= AudioCategory.DEFAULT

The category that the track belongs to.

volume: number= 1

loop: boolean= false

Returns

IAudioTrack

The created IAudioTrack.

Implementation of

IAudioManager.createAudioTrack

Source

src/audio/HowlerManager.ts:319


fadeTo()

fadeTo(trackId, category, volume, pDuration): 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.

pDuration: number

The time in milliseconds it should take to fade.

Returns

void

Implementation of

IAudioManager.fadeTo

Source

src/audio/HowlerManager.ts:303


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.

Implementation of

IAudioManager.getAudioTrack

Source

src/audio/HowlerManager.ts:311


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.

Implementation of

IAudioManager.getCategoryVolume

Source

src/audio/HowlerManager.ts:182


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.

Implementation of

IAudioManager.getDuration

Source

src/audio/HowlerManager.ts:191


init()

init(): void

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

Returns

void

Implementation of

IAudioManager.init

Source

src/audio/HowlerManager.ts:174


load()

load(ids, category, onLoadCallback?): void

Loads one or more tracks.

Parameters

ids: 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

Implementation of

IAudioManager.load

Source

src/audio/HowlerManager.ts:247


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

Implementation of

IAudioManager.pause

Source

src/audio/HowlerManager.ts:231


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= 1

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

loop: boolean= false

Should the track loop or not.

category: string= AudioCategory.DEFAULT

The category that the track belongs to.

pitch?: number

the pitch of the track

Returns

undefined | IAudioTrack

The track playing.

Implementation of

IAudioManager.play

Source

src/audio/HowlerManager.ts:201


setCategoryVolume()

setCategoryVolume(category, pVolume): void

Sets the volume of a specific category.

Parameters

category: string

The category to set.

pVolume: number

The volume to set.

Returns

void

Implementation of

IAudioManager.setCategoryVolume

Source

src/audio/HowlerManager.ts:186


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

Implementation of

IAudioManager.stop

Source

src/audio/HowlerManager.ts:239


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= false

Whether the IAudioTrack should be removed and destroyed too.

Returns

void

Implementation of

IAudioManager.unload

Source

src/audio/HowlerManager.ts:291