Repository

Renderer

Extends:

Component → Renderer

Renderer is a Web Audio API based renderer for playing sound.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public
public
public
public
public
public

sources: *[]

Method Summary

Public Methods
public

beep(frequency: *)

public

creates a webaudioAPI analyzer to extract frequencies from the audio source used in this renderer

public
public

Get this audioContext's gain volume

public

Maintains an array of all the sources attached to this renderer

public

Set the update of the forward and up vector of this audio listener to be automatic (computed from the given 3D object transform) or not (will stay at (0, 0, -1, 0, 1, 0))

public

Set the position of the listner in 3D space ONLY when transform from a 3D object has not been attached to the listener (cf setListenerTransform())

public

Set the listener orientation through the given Mobilizing/Three.js quaternion.

public

Attach a Transform object, usually coming from a 3D graphical object, to this renderer listener (the "ears").

public

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

public

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 setup 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

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.listenerAutoUpdateRotationBoolean
  • optional
  • default: true

Set the update of the forward and up vector of this audio listener to be automatic

Example:

    //to do

Public Members

public analyser: * source

Properties:

NameTypeAttributeDescription
analyser*

audio analyser

public analyserArray: * source

Properties:

NameTypeAttributeDescription
analyserArray*

Uint8Array for accessing frequencies

public audioContext: * source

public listener: * source

public listenerAutoUpdateRotation: * source

public masterGain: * source

public sources: *[] source

Public Methods

public beep(frequency: *) source

Params:

NameTypeAttributeDescription
frequency*

public createAnalyzer(fftSize: Number) source

creates a webaudioAPI analyzer to extract frequencies from the audio source used in this renderer

Params:

NameTypeAttributeDescription
fftSizeNumber

public getCurrentTime(): Number source

Return:

Number

the current time of this audio renderer

public getMasterGain(val: Number): * source

Get this audioContext's gain volume

Params:

NameTypeAttributeDescription
valNumber

Return:

*

public registerNode(source: Source) source

Maintains an array of all the sources attached to this renderer

Params:

NameTypeAttributeDescription
sourceSource

public setListenerAutoUpdateRotation(value: Boolean) source

Set the update of the forward and up vector of this audio listener to be automatic (computed from the given 3D object transform) or not (will stay at (0, 0, -1, 0, 1, 0))

Params:

NameTypeAttributeDescription
valueBoolean

public setListenerPosition(pos: Object | Vector3) source

Set the position of the listner in 3D space ONLY when transform from a 3D object has not been attached to the listener (cf setListenerTransform())

Params:

NameTypeAttributeDescription
posObject | Vector3

An object containing x,y,z coordinates in space (can be a Vector3 from the 3D renderer)

public setListenerQuaternion(quaternion: Quaternion) source

Set the listener orientation through the given Mobilizing/Three.js quaternion. Directions (i.e forwardVector and upVector) are extracted by the Quaternion Class.

Params:

NameTypeAttributeDescription
quaternionQuaternion

Mobilizing/Three.js quaternion to use for this listener orientation

public setListenerTransform(transform: Transform) source

Attach a Transform object, usually coming from a 3D graphical object, to this renderer listener (the "ears"). The listener position and orientation (rotation) will be automatically updated against the given Transform.

Params:

NameTypeAttributeDescription
transformTransform

public setMasterGain(val: Number) source

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

Params:

NameTypeAttributeDescription
valNumber

public update() source

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

Override:

Component#update