API Docs for: 0.3.0
Show:

Audio.Manager Class

Module: Audio

Manager class is utility for manage all sound in channel.

Constructor

Audio.Manager

()

Methods

_handleAllInstancesReady

(
  • channel
)
private

Used has callback for the allSoundsReady event.

Parameters:

  • channel Object

_tellAllInstances

(
  • command
  • [value]
)
private

Applies the command to all channels.

Parameters:

  • command String

    commands availables:

    • "pause"
    • "resume"
    • "setVolume"
    • "mute"
    • "stop"
  • [value] optional

    argument

add

(
  • src
  • max
)
Number

Create new channel with src and max sound instance.

Parameters:

  • src String | String

    The source(s) of channel. If many values are passed, the first compatibel are used.

  • max Number

    The number of sound allocated in this channel.

Returns:

Number: The id of the channel.

get

(
  • uniqueId
)
Object

Get a channel.

Parameters:

  • uniqueId Number

    The id of the channel need get.

Returns:

Object: The channel with uniqueId.

getMasterVolume

() Number

Get a current master volume.

Returns:

Number: A current master volume.

getPlayableSound

(
  • uniqueId
)
Object

Get a playable sound.

Parameters:

  • uniqueId Number

    The id of the channel need get a sound.

Returns:

Object: A playable sound.

loadAll

()

Load all sounds on all channels.

pause

()

Pause all sound in every channel.

remove

(
  • uniqueId
)
Boolean

Remove a channel.

Parameters:

  • uniqueId Number

    The id of the channel need remove.

Returns:

Boolean: True if the channel has been remove or False.

resume

()

Resume all sound in every channel.

setMasterVolume

(
  • value
)

Set a volume for all sound in every channel.

Parameters:

  • value Number

    The value of volume needed. min: 0.0 -> max: 1.0

setMute

(
  • isMuted
)

Mute or Unmute all sound in every channel.

Parameters:

  • isMuted Boolean

    True for mute or false for unmute.

stop

()

Stop all sound in every channel.

Properties

_instances

Array private

Array of Channel.

Default: []

_lastId

Number private

LastId of Channel.

Default: 0

_masterVolume

Number private

Volume of all sound in all channel, between 0.0 and 1.0.

Default: 1

_ready

Number private

Number of Channel ready to play.

Default: 0

allInstancesReady

Function

Callback function when all channel is ready to play.

Default: null

instanceReady

Function

Callback function when a channel is ready to play.

Default: null

Sub-properties:

  • id Number

    first callback arg; id of ready instance.

length

Number

Number of Channel.

Default: 0