Repository

Source

Extends:

Component → Source

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public

buffer: *

public
public
public

gain: *

public

is3D: *

public

loop: *

public
public
public
public
public

panner: *

public
public
public
public
public
public

Method Summary

Public Methods
public

connect(dest: AudioNode)

If you need to connect WebAudio AudioNode by yourself, use this method with the access to the WebAudio Node given by getNativeSource()

public

createFromMediaStream(stream: MediaStream, autoConnect: boolean=true)

public

Disconnects this source from it current destination

public
public

getGain(val: Number): *

Get this audioContext's gain volume

public

get this source loop

public

getNativeSource(): AudioBufferSourceNode

Return the underlying WebAudio audio source

public

Gets the offset play of this sound

public

Get this source playback rate (speed)

public

Gets the offset play of this sound

public

off()

public
public

on()

public

pauses the Source.

public

play()

Play this sound source

public
public

setBuffer(buffer: Object)

set the current Source buffer

public
public
public
public

setGain(gain: Number, rampValue: Number)

Set this source's gain volume, use a 1 sec linear ramp to avoid clicks

public

setLoop(enabled: Boolean)

set this source loop

public

Sets the maximum distance for sound propagation in space

public

Sets the offset play of this sound

public

Set this source playback rate (speed)

public

Sets the reference distance for sound attenuation through space

public

Sets the start time play of this sound in current rendrer time

public

setTransform(transform: Object)

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

public

stop()

stops the Source.

public

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

Inherited Summary

From class Component
public
public
public

events: *

public

id: *

public

name: *

private

_nexts: *[]

private
public
public

chain(component: Component)

Adds a component to this chained component array

public

Returns the array of attached children components

public

off()

Deactivate the component

public

on()

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

public

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

public

preLoad the component This empty method is usually overriden to perform preLoad actions for the component.

public

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

public

prepare the component This empty method is usually overriden to perform preparation actions for the component, from external process as a server.

public

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

public

Update the component This empty method is usually overriden to perform update actions for the component It is called periodically by an internal Mobilizing mechanism

Public Constructors

public constructor(params: Object) source

Override:

Component#constructor

Params:

NameTypeAttributeDescription
paramsObject

Parameters object, given by the constructor.

params.rendererRenderer

the audio renderer

params.is3Dbool

is the audio source positionned in 3D ?

params.loopbool

should the source be played in loop ?

params.autoUpdateRotationbool

should the orientation of the source be updated automatically ?

Public Members

public autoUpdateRotation: * source

public buffer: * source

public currentTime: number source

public duration: * source

public gain: * source

public is3D: * source

public loop: * source

public loopCount: number source

public mediaElement: * source

public nativeAudioSource: * source

public offsetStartTime: number source

public panner: * source

public playbackRate: number source

public playing: boolean source

public renderer: * source

public scheduleStartTime: number source

public startedTime: number source

public transform: * source

Public Methods

public connect(dest: AudioNode) source

If you need to connect WebAudio AudioNode by yourself, use this method with the access to the WebAudio Node given by getNativeSource()

Params:

NameTypeAttributeDescription
destAudioNode

the destination to connect this source to. If this param is undefined, the connection will be made automatically with the renderer's masterGain

public createFromMediaStream(stream: MediaStream, autoConnect: boolean=true) source

Params:

NameTypeAttributeDescription
streamMediaStream

the MediaStream from which to create this AudioSource

autoConnectboolean=true

if false is given, this source' gain will be disconnected from the destination (renderer masterGain node). Usefull for mic stream analysis that don't need to hear but need to connect to the analyser

public disconnect() source

Disconnects this source from it current destination

public generateAudioBufferSource() source

public getGain(val: Number): * source

Get this audioContext's gain volume

Params:

NameTypeAttributeDescription
valNumber

Return:

*

public getLoop(): Boolean source

get this source loop

Return:

Boolean

enabled

public getNativeSource(): AudioBufferSourceNode source

Return the underlying WebAudio audio source

Return:

AudioBufferSourceNode

webAudio source

public getOffsetStartTime(): Number source

Gets the offset play of this sound

Return:

Number

the time to start to play the sound buffer

public getPlaybackRate(): Number source

Get this source playback rate (speed)

Return:

Number

public getScheduleStartTime(): Number source

Gets the offset play of this sound

Return:

Number

the time to start to play the sound buffer

public off() source

Deactivate the component

Override:

Component#off

public offlinePlay() source

public on() source

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

Override:

Component#on

public pause() source

pauses the Source.

public play() source

Play this sound source

public setAutoUpdateRotation(val: Boolean) source

Params:

NameTypeAttributeDescription
valBoolean

public setBuffer(buffer: Object) source

set the current Source buffer

Params:

NameTypeAttributeDescription
bufferObject

the AudioBuffer we want the source to play.

public setConeInnerAngle(angle: Number) source

Params:

NameTypeAttributeDescription
angleNumber

public setConeOuterAngle(angle: Number) source

Params:

NameTypeAttributeDescription
angleNumber

public setConeOuterGain(val: Number) source

Params:

NameTypeAttributeDescription
valNumber

public setGain(gain: Number, rampValue: Number) source

Set this source's gain volume, use a 1 sec linear ramp to avoid clicks

Params:

NameTypeAttributeDescription
gainNumber
rampValueNumber

in seconds

public setLoop(enabled: Boolean) source

set this source loop

Params:

NameTypeAttributeDescription
enabledBoolean

public setMaxDistance(val: Number) source

Sets the maximum distance for sound propagation in space

Params:

NameTypeAttributeDescription
valNumber

public setOffsetStartTime(val: Number) source

Sets the offset play of this sound

Params:

NameTypeAttributeDescription
valNumber

the time to start to play the sound buffer

public setPlaybackRate(val: Number) source

Set this source playback rate (speed)

Params:

NameTypeAttributeDescription
valNumber

public setRefDistance(val: Number) source

Sets the reference distance for sound attenuation through space

Params:

NameTypeAttributeDescription
valNumber

public setScheduleStartTime(val: Number) source

Sets the start time play of this sound in current rendrer time

Params:

NameTypeAttributeDescription
valNumber

the time to start to play the sound buffer

public setTransform(transform: Object) source

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

Params:

NameTypeAttributeDescription
transformObject

the Transform.

public stop() source

stops the Source.

public update() source

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

Override:

Component#update