Home Reference Source Repository
import {Source} from 'binaural/src/audio/Source.js'
public class | source

Source

Single source.

See:

Constructor Summary

Public Constructor
public

constructor(options: Object)

Construct a source, with and AudioContext and an HrtfSet.

Member Summary

Public Members
public set

crossfadeDuration(duration: Number): *

Set the crossfade duration when the position changes.

public get

Get the crossfade duration when the position changes.

public set

hrtfSet(hrtfSet: HrtfSet): *

Refer an external HRTF set.

public get

Get the HrtfSet.

public set

position(positionRequest: Coordinates): *

Set the position of the source and updates.

Method Summary

Public Methods
public

connectInput(nodesToConnect: AudioNode | Array<AudioNode>, output: Number, input: Number): this

Connect the input of a source.

public

connectOutput(nodesToConnect: AudioNode | Array<AudioNode>, output: Number, input: Number): this

Connect the output of a source.

public

disconnectInput(nodesToDisconnect: AudioNode | Array<AudioNode>): this

Disconnect the input of a source.

public

disconnectOutput(nodesToDisconnect: AudioNode | Array<AudioNode>): this

Disconnect the output of a source.

Public Constructors

public constructor(options: Object) source

Construct a source, with and AudioContext and an HrtfSet.

Params:

NameTypeAttributeDescription
options Object
options.audioContext AudioContext

mandatory for the creation of FIR audio buffers

options.hrtfSet HrtfSet

Source#hrtfSet

options.position coordinate
  • optional
  • default: [0,0,0]

in 'gl' coordinate system. Source#position

options.crossfadeDuration Number
  • optional

in seconds Source#crossfadeDuration

See:

Public Members

public set crossfadeDuration(duration: Number): * source

Set the crossfade duration when the position changes.

public get crossfadeDuration: Number: * source

Get the crossfade duration when the position changes.

Return:

Number

in seconds

public set hrtfSet(hrtfSet: HrtfSet): * source

Refer an external HRTF set.

public get hrtfSet: HrtfSet: * source

Get the HrtfSet.

Return:

HrtfSet

public set position(positionRequest: Coordinates): * source

Set the position of the source and updates.

Public Methods

public connectInput(nodesToConnect: AudioNode | Array<AudioNode>, output: Number, input: Number): this source

Connect the input of a source.

Params:

NameTypeAttributeDescription
nodesToConnect AudioNode | Array<AudioNode>
output Number
  • optional
  • default: 0

output to connect from

input Number
  • optional
  • default: 0

input to connect to

Return:

this

public connectOutput(nodesToConnect: AudioNode | Array<AudioNode>, output: Number, input: Number): this source

Connect the output of a source.

Params:

NameTypeAttributeDescription
nodesToConnect AudioNode | Array<AudioNode>
output Number
  • optional
  • default: 0

output to connect from

input Number
  • optional
  • default: 0

input to connect to

Return:

this

public disconnectInput(nodesToDisconnect: AudioNode | Array<AudioNode>): this source

Disconnect the input of a source.

Params:

NameTypeAttributeDescription
nodesToDisconnect AudioNode | Array<AudioNode>

disconnect all when undefined.

Return:

this

public disconnectOutput(nodesToDisconnect: AudioNode | Array<AudioNode>): this source

Disconnect the output of a source.

Params:

NameTypeAttributeDescription
nodesToDisconnect AudioNode | Array<AudioNode>

disconnect all when undefined.

Return:

this