API Documentation

for 0.0.1
Show:

AudioSource Class

AudioSource Class. Encapsulates the concept of Audio source, a sound-emitting entity with a given position in space. requires the Web Audio API.

Constructor

AudioSource

(
  • params
)

Parameters:

  • params Object

    the parameters object

Methods

byPass TODO!

()

chain

(
  • component
)
Adds a component to this chained component array

Parameters:

getChainedComponents

() Array
Returns the array of attached children components

Returns:

Array: children arrays

getContext

() Context

Inherited from Base but overwritten in src/js/Mobilizing/Base.js:37

Get the Mobilizing context

Returns:

Context: The Mobilizing context

getID

() Int
Get the Object unique ID

Returns:

Int: The Object ID

getStatus

() Boolean
Get the activation status of the component

Returns:

Boolean: True if active, false otherwise

off

()
Deactivate the component

on

()
Activate the component A call to this method calls the setup method if it has not been run yet

pause

()

pauses the AudioSource.

play

()

plays the AudioSource

postUpdate

()
Run code after the update of all components is run This empty method is usually overriden to perform post-update actions for the component It is called periodically by an internal Mobilizing mechanism

preLoad

()
preLoad the component This empty method is usually overriden to perform setup actions for the component. The preLoad is designed to be called before any other method, even setup. In the case of user scripts, it is used to preload all needed datas before the setup (pictures, font, etc.) It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

preUpdate

()
Run code before the update of all components is run This empty method is usually overriden to perform pre-update actions for the component It is called once per component by an internal Mobilizing mechanism

runSetup

()
Calls the setup if it has not already been called This method should not be called This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

set3D

(
  • enabled
)

set 3D propagation

Parameters:

  • enabled Boolean

setBuffer

(
  • buffer
)

set the current AudioSource buffer

Parameters:

  • buffer Object

    the AudioBuffer we want the source to play.

setContext

(
  • context
)
Set the Mobilizing context

Parameters:

  • context Context
    The Mobilizing Context

setLoop

(
  • enabled
)

set this source loop

Parameters:

  • enabled Boolean

setMaxDistance

(
  • val
)

Sets the maximum distance for sound propagation in space

Parameters:

  • val Number

setName

(
  • name
)
Set the Object name

Parameters:

  • name String
    The Object name

setRefDistance

(
  • val
)

Sets the reference distance for sound attenuation through space

Parameters:

  • val Number

setTransform

(
  • transform
)

set the current Transform that represents the AudioSource position in space.

Parameters:

  • transform Object

    the Transform.

setup

()
Set's up the component This empty method is usually overriden to perform setup actions for the component This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

stop

()

stops the AudioSource.

update

()

Inherited from Component but overwritten in src/js/Mobilizing/audio/AudioSource.js:99

Updates the source's position in space if given from a transform

Properties

_active

Boolean private
Whether the component is active or not

_context

Context private
A reference to the Mobilizing context

_setupDone

Boolean private
Whether the component's setup has been called

events

EventEmitter
An event emmiter used to send custom events