IAudioTrack
All audio track implementations need to implement this interface to function with the framework.
Properties
id
readonly
id:string
Source
Methods
fadeTo()
fadeTo(
volume
,milliseconds
):void
Fades this track from it’s current volume over time.
Parameters
• volume: number
The volume to fade to.
• milliseconds: number
The time in milliseconds the fade should take finish.
Returns
void
Source
getDuration()
getDuration():
number
Gets the length of the track.
Returns
number
the length of the track.
Source
getPitch()
getPitch():
number
Returns
number
Source
getTimePos()
getTimePos():
number
Gets the current time position within the track timeline.
Returns
number
the time position
Source
getVolume()
getVolume():
number
Gets the base volume of this track. This will be used to calculate the appropriate source volume.
Returns
number
the base volume of this track.
Source
isLooped()
isLooped():
boolean
Gets whether the track is set to loop.
Returns
boolean
true if the track is set to loop, false otherwise.
Source
isMuted()
isMuted():
boolean
Gets whether the track is muted.
Returns
boolean
true if the track is muted, false otherwise.
Source
isPlaying()
isPlaying():
boolean
Gets whether the track is currently playing.
Returns
boolean
true if currently playing, false otherwise.
Source
loadSource()
loadSource():
void
Loads the source file into memory. Must be called before play() is called.
Returns
void
Source
off()
off(
eventName
,callback
?):void
Unregister a callback from an event.
Parameters
• eventName: string
The event that was listened for.
• callback?
The callback to call when the event occured. Omit this to remove all events of type.
Returns
void
Source
on()
on(
eventName
,callback
):void
Register a callback to an event.
Parameters
• eventName: string
The event to listen for.
• callback
The callback to call when the event occurs.
Returns
void
Source
once()
once(
eventName
,callback
):void
Shortcut to register a callback to an event and have it only be called once.
Parameters
• eventName: string
The event to listen for.
• callback
The callback to call when the event occurs.
Returns
void
Source
pause()
pause():
void
Pauses the track.
Returns
void
Source
play()
play():
void
Plays the track.
Returns
void
Source
setLooped()
setLooped(
pLoop
):void
Sets the loop flag for this track.
Parameters
• pLoop: boolean
true to loop and false to play once.
Returns
void
Source
setMuted()
setMuted(
mute
):void
Set the muted flag for this track.
Parameters
• mute: boolean
true to mute and false to unmute.
Returns
void
Source
setPitch()
setPitch(
pitch
?):void
Parameters
• pitch?: number
Returns
void
Source
setTimePos()
setTimePos(
pos
):void
Sets the current time position within the track timeline.
Parameters
• pos: number
The time position to set the track to.
Returns
void
Source
setVolume()
setVolume(
volume
):void
Sets the base volume of this track. This will be used to calculate the appropriate source volume.
Parameters
• volume: number
The new volume of this track.
Returns
void
Source
setVolumeWithModifiers()
setVolumeWithModifiers(
volume
,masterVolume
,categoryVolume
):void
Sets the base volume of this track and then applies modifiers to get the final output volume.
Parameters
• volume: number
The new volume of this track.
• masterVolume: number
The current master volume level.
• categoryVolume: number
The current volume of this track’s category.
Returns
void
Source
stop()
stop():
void
Stops the track.
Returns
void
Source
unloadSource()
unloadSource():
void
Unloads the source file.
Returns
void