Constructor

new(options:HowlOptions)

Methods

duration(?id:Int):Int

Get the duration of this sound. Passing a sound id will return the sprite duration.

Parameters:

id

The sound id to check. If none is passed, return full source duration.

Returns:

Audio duration in seconds.

fade(from:Float, to:Float, len:Int, ?id:Int):Howl

Fade a currently playing sound between two volumes (if no id is passsed, all sounds will fade). @return

Parameters:

from

The value to fade from (0.0 to 1.0).

to

The volume to fade to (0.0 to 1.0).

len

Time in milliseconds to fade.

id

The sound id (omit to fade all sounds).

load():Howl

Load the audio file. @return

loop(?loop:Dynamic, ?id:Int):Dynamic

Get/set the loop parameter on a sound. This method can optionally take 0, 1 or 2 arguments.

loop() -> Returns the group's loop value.
loop(id) -> Returns the sound id's loop value.
loop(loop) -> Sets the loop value for all sounds in this Howl group.
loop(loop, id) -> Sets the loop value of passed sound id.

Returns:

Returns self or current loop value.

mute(muted:Bool, ?id:Int):Howl

Mute/unmute a single sound or all sounds in this Howl group. @return

Parameters:

muted

Set to true to mute and false to unmute.

id

The sound ID to update (omit to mute/unmute all).

off(event:String, fn:Function, ?id:Int):Howl

Remove a custom event. Call without parameters to remove all events. @return

Parameters:

event

Event name.

fn

Listener to remove. Leave empty to remove all.

id

(optional) Only remove events for this sound.

on(event:String, fn:Function, ?id:Int):Howl

Listen to a custom event. @return

Parameters:

event

Event name.

fn

Listener to call.

id

(optional) Only listen to events for this sound.

once(event:String, fn:Function, ?id:Int):Howl

Listen to a custom event and remove it once fired. @return

Parameters:

event

Event name.

fn

Listener to call.

id

(optional) Only listen to events for this sound.

pause(?id:Int):Howl

Pause playback and save current position. @return

Parameters:

id

The sound ID (empty to pause all in group).

play(?sprite:Dynamic):Int

Play a sound or resume previous playback.

Parameters:

sprite

Sprite name for sprite playback or sound id to continue previous.

Returns:

Sound ID.

playing(?id:Int):Bool

Check if a specific sound is currently playing or not (if id is provided), or check if at least one of the sounds in the group is playing or not.

Parameters:

id

The sound id to check. If none is passed, the whole sound group is checked.

Returns:

True if playing and false if not.

pos(?x:Float, ?y:Float, ?z:Float, ?id:Int):Dynamic

Get/set the 3D spatial position of the audio source for this sound or group relative to the global listener.

Parameters:

x

The x-position of the audio source.

y

The y-position of the audio source.

z

The z-position of the audio source.

id

The sound ID. If none is passed, all in group will be updated.

Returns:

Returns self or the current 3D spatial position: [x, y, z].

rate(?rate:Float, ?id:Int):Dynamic

Get/set the playback rate of a sound. This method can optionally take 0, 1 or 2 arguments.

rate() -> Returns the first sound node's current playback rate.
rate(id) -> Returns the sound id's current playback rate.
rate(rate) -> Sets the playback rate of all sounds in this Howl group.
rate(rate, id) -> Sets the playback rate of passed sound id.

Returns:

Returns self or the current playback rate.

seek(?seek:Float, ?id:Int):Dynamic

Get/set the seek position of a sound (in seconds). This method can optionally take 0, 1 or 2 arguments.

seek() -> Returns the first sound node's current seek position.
seek(id) -> Returns the sound id's current seek position.
seek(seek) -> Sets the seek position of the first sound node.
seek(seek, id) -> Sets the seek position of passed sound id.

Returns:

Returns self or the current seek position.

state():String

Returns the current loaded state of this Howl.

Returns:

'unloaded', 'loading', 'loaded'

stereo(?pan:Float, ?id:Int):Dynamic

Get/set the stereo panning of the audio source for this sound or all in the group.

Parameters:

pan

A value of -1.0 is all the way left and 1.0 is all the way right.

id

(optional) The sound ID. If none is passed, all in group will be updated.

Returns:

Returns self or the current stereo panning value.

stop(?id:Int):Howl

Stop playback and reset to start. @return

Parameters:

id

The sound ID (empty to stop all in group).

unload():Void

Unload and destroy the current Howl object. This will immediately stop all sound instances attached to this group.

volume(?vol:Float, ?id:Int):Dynamic

Get/set the volume of this sound or of the Howl group. This method can optionally take 0, 1 or 2 arguments.

volume() -> Returns the group's volume value.
volume(id) -> Returns the sound id's current volume.
volume(vol) -> Sets the volume of all sounds in this Howl group.
volume(vol, id) -> Sets the volume of passed sound id.

Returns:

Returns self or current volume.