AudioAsset

An AudioAsset is an {@Asset} for referencing an audio file resource. This is stored as an AudioMediaElement DOM element.

Constructor

new L3D.AudioAsset()

Extends

Properties

audio DOMAudio

The audio element

canPlayThrough bool

True if the audio element has loaded enough of the audio data to play it.

currentTime number = 0

The current time of the audio playback

duration number

The duration of the audio.

ended bool = false

True if the audio has finished playing.

Overrides:
filename String

Get the filename of the asset.

Overrides:
id String

The unique identifier of the object. Changing a node's ID can have unintended consequences.

Overrides:
isLoaded bool

True if the asset has finished loading.

Overrides:
isLoading bool

True if the asset is in the process of loading.

isPlaying bool

True if the audio is currently playing.

Overrides:
isValid bool

True if the asset does not have an error.

loop bool = false

True if the audio loops back to the beginning when it reaches the end.

muted bool = false

True if the audio is currently muted.

Overrides:
name String

The name of the object.

Overrides:
onError Signal

Emitted when there was an error loaading the asset.

Overrides:
onLoad Signal

Emitted when the asset has finished loading.

Overrides:
onLoading Signal

Emitted when the asset has started loading.

Overrides:
onModified Signal

Fired when the object has been modified.

Overrides:
onNameChanged Signal

Fired when the object's name changes.

Overrides:
onStateChange Signal

Emitted when the state of the asset has changed.

Overrides:
onUpdate Signal

Emitted when the assets data has been updated.

Overrides:
path String

The URL of the asset.

paused bool = false

True if the audio is currently paused.

playbackRate number = 1

The speed of audio playback. Changing the playback rate affects the pitch of the audio playback.

src String

The URL of the audio data.

Overrides:
state number

Inidicates whether the asset is Unloaded, Loading, Loaded, or Error. The onStateChange signal will be emitted when the state's value changes.

volume number = 1

The volume of the audio playback.

Methods

clone(options) → Object

Overrides:

Creates a clone of this object.

Parameters
options Object

Options for the clone method.

Returns
Object

configure(o)

Overrides:

Set the properties of the object from a JSON structure.

Parameters
o Object

Serialized data to configure the object with

destroy()

Overrides:

Destroy any render assets created by the asset.

getPropertyInfo(path) → Object

Overrides:

Get information about a particular property of this object.

Parameters
path String
Returns
Object

getRenderAsset(gl)RenderAsset

Overrides:

Get a RenderAsset for this asset. If a RenderAsset hadn't been requested for the given GLContext yet, a new one will be created. Otherwise the previous one will be updated and returned.

A RenderAsset is the WebGL version of the asset, such as the GLTexture for an Texture asset. Because the editor has multiple GLContexts, RenderAssets are generated for each GLContext that requires it.

Parameters
gl GLContext
Returns
RenderAsset

pause()

Pause playback of the audio, if it's playing.

play()

Start playback of the audio.

serialize() → Object

Overrides:

Serialize the object to a JSON structure.

Returns
Object

The serialized version of the object.

setModified()

Overrides:

Fires the objects onModified signal.

toJSON() → Object

Overrides:

Serialize the object to a JSON structure

Returns
Object

The serialized version of the object.

updateRenderAsset(renderAsset)

Overrides:

Update the given RenderAsset.

Parameters
renderAsset RenderAsset

The RenderAsset to update.