Skip to content

HowlerTrack

Class representing a Howler audio track.

Implements

Constructors

new HowlerTrack()

new HowlerTrack(trackId, category, audioManager, volume, loop): HowlerTrack

Create a new Howler audio track.

Parameters

trackId: string

The ID of the audio track.

category: string

The category of the audio track.

audioManager: IAudioManager

The audio manager for the audio track.

volume: number= 1

The volume of the audio track.

loop: boolean= false

Whether the audio track should loop.

Returns

HowlerTrack

Source

src/audio/HowlerTrack.ts:58

Properties

FILE_EXTENSIONS

static FILE_EXTENSIONS: string[]

File extensions that Howler will attempt to load audio files with, in this order.

Default

["webm", "mp3", "ogg", "m4a"]

Source

src/audio/HowlerTrack.ts:32

Accessors

id

get id(): string

Get the ID of the audio track.

Returns

string

The ID of the audio track.

Source

src/audio/HowlerTrack.ts:85

Methods

fadeTo()

fadeTo(volume, milliseconds): void

Fade the audio track to a specified volume over a specified duration.

Parameters

volume: number

The target volume.

milliseconds: number

The duration of the fade.

Returns

void

Implementation of

IAudioTrack.fadeTo

Source

src/audio/HowlerTrack.ts:119


getDuration()

getDuration(): number

Get the duration of the audio track.

Returns

number

The duration of the audio track.

Implementation of

IAudioTrack.getDuration

Source

src/audio/HowlerTrack.ts:260


getPitch()

getPitch(): number

Get the pitch of the audio track.

Returns

number

The pitch of the audio track.

Implementation of

IAudioTrack.getPitch

Source

src/audio/HowlerTrack.ts:236


getSource()

getSource(): Howl

Get the source of the audio track.

Returns

Howl

The source of the audio track.

Source

src/audio/HowlerTrack.ts:303


getTimePos()

getTimePos(): number

Get the time position of the audio track.

Returns

number

The time position of the audio track.

Implementation of

IAudioTrack.getTimePos

Source

src/audio/HowlerTrack.ts:244


getVolume()

getVolume(): number

Get the volume of the audio track.

Returns

number

The volume of the audio track.

Implementation of

IAudioTrack.getVolume

Source

src/audio/HowlerTrack.ts:193


isLooped()

isLooped(): boolean

Check if the audio track is looped.

Returns

boolean

Whether the audio track is looped.

Implementation of

IAudioTrack.isLooped

Source

src/audio/HowlerTrack.ts:171


isMuted()

isMuted(): boolean

Check if the audio track is muted.

Returns

boolean

Whether the audio track is muted.

Implementation of

IAudioTrack.isMuted

Source

src/audio/HowlerTrack.ts:155


isPlaying()

isPlaying(): boolean

Check if the audio track is playing.

Returns

boolean

Whether the audio track is playing.

Implementation of

IAudioTrack.isPlaying

Source

src/audio/HowlerTrack.ts:268


loadSource()

loadSource(): void

Load the source of the audio track.

Returns

void

Implementation of

IAudioTrack.loadSource

Source

src/audio/HowlerTrack.ts:135


off()

off(eventName, callback?): void

Remove an event listener from the audio track.

Parameters

eventName: string

The name of the event.

callback?

The callback function.

Returns

void

Implementation of

IAudioTrack.off

Source

src/audio/HowlerTrack.ts:286


on()

on(eventName, callback): void

Add an event listener to the audio track.

Parameters

eventName: string

The name of the event.

callback

The callback function.

Returns

void

Implementation of

IAudioTrack.on

Source

src/audio/HowlerTrack.ts:277


once()

once(eventName, callback): void

Add an event listener to the audio track that will be called once.

Parameters

eventName: string

The name of the event.

callback

The callback function.

Returns

void

Implementation of

IAudioTrack.once

Source

src/audio/HowlerTrack.ts:295


pause()

pause(): void

Pause the audio track.

Returns

void

Implementation of

IAudioTrack.pause

Source

src/audio/HowlerTrack.ts:103


play()

play(): void

Play the audio track.

Returns

void

Implementation of

IAudioTrack.play

Source

src/audio/HowlerTrack.ts:92


setLooped()

setLooped(pLoop): void

Set whether the audio track is looped.

Parameters

pLoop: boolean

Whether the audio track should be looped.

Returns

void

Implementation of

IAudioTrack.setLooped

Source

src/audio/HowlerTrack.ts:185


setMuted()

setMuted(value): void

Set whether the audio track is muted.

Parameters

value: boolean

Whether the audio track should be muted.

Returns

void

Implementation of

IAudioTrack.setMuted

Source

src/audio/HowlerTrack.ts:163


setPitch()

setPitch(pitch?): void

Set the pitch of the audio track.

Parameters

pitch?: number

The pitch of the audio track.

Returns

void

Implementation of

IAudioTrack.setPitch

Source

src/audio/HowlerTrack.ts:226


setTimePos()

setTimePos(pPos): void

Set the time position of the audio track.

Parameters

pPos: number

The time position of the audio track.

Returns

void

Implementation of

IAudioTrack.setTimePos

Source

src/audio/HowlerTrack.ts:252


setVolume()

setVolume(volume): void

Set the volume of the audio track.

Parameters

volume: number

The volume of the audio track.

Returns

void

Implementation of

IAudioTrack.setVolume

Source

src/audio/HowlerTrack.ts:201


setVolumeWithModifiers()

setVolumeWithModifiers(volume, masterVolume, categoryVolume): void

Set the volume of the audio track with modifiers.

Parameters

volume: number

The volume of the audio track.

masterVolume: number

The master volume.

categoryVolume: number

The category volume.

Returns

void

Implementation of

IAudioTrack.setVolumeWithModifiers

Source

src/audio/HowlerTrack.ts:215


stop()

stop(): void

Stop the audio track.

Returns

void

Implementation of

IAudioTrack.stop

Source

src/audio/HowlerTrack.ts:110


unloadSource()

unloadSource(): void

Unload the source of the audio track.

Returns

void

Implementation of

IAudioTrack.unloadSource

Source

src/audio/HowlerTrack.ts:128