HRTFOutput represents the Listener. Sources (HRTFInputs) are arranged around this to create spatialized audio.

Example

let listener = new HRTFOutput(audioContext);
let limiter = new Limiter(audioContext);
let destination = audioContext.createMediaStreamDestination();
listener.connect(limiter).connect(destination);

Hierarchy

  • AudioWorkletNode
    • HRTFOutput

Constructors

  • Parameters

    • audioContext: AudioContext

      The AudioContext to use. It should be created with a sample-rate of 48000.

    Returns HRTFOutput

Properties

channelCount: number
channelCountMode: ChannelCountMode
channelInterpretation: ChannelInterpretation
context: BaseAudioContext
numberOfInputs: number
numberOfOutputs: number
onprocessorerror: ((this: AudioWorkletNode, ev: Event) => any)

Type declaration

    • (this: AudioWorkletNode, ev: Event): any
    • Parameters

      • this: AudioWorkletNode
      • ev: Event

      Returns any

parameters: AudioParamMap
port: MessagePort

Methods

  • Type Parameters

    • K extends "processorerror"

    Parameters

    • type: K
    • listener: ((this: AudioWorkletNode, ev: AudioWorkletNodeEventMap[K]) => any)
        • (this: AudioWorkletNode, ev: AudioWorkletNodeEventMap[K]): any
        • Parameters

          • this: AudioWorkletNode
          • ev: AudioWorkletNodeEventMap[K]

          Returns any

    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Parameters

    • type: string
    • listener: EventListenerOrEventListenerObject
    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Parameters

    • destinationNode: AudioNode
    • Optional output: number
    • Optional input: number

    Returns AudioNode

  • Parameters

    • destinationParam: AudioParam
    • Optional output: number

    Returns void

  • Returns void

  • Parameters

    • output: number

    Returns void

  • Parameters

    • destinationNode: AudioNode

    Returns void

  • Parameters

    • destinationNode: AudioNode
    • output: number

    Returns void

  • Parameters

    • destinationNode: AudioNode
    • output: number
    • input: number

    Returns void

  • Parameters

    • destinationParam: AudioParam

    Returns void

  • Parameters

    • destinationParam: AudioParam
    • output: number

    Returns void

  • Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

    Parameters

    • event: Event

    Returns boolean

  • Type Parameters

    • K extends "processorerror"

    Parameters

    • type: K
    • listener: ((this: AudioWorkletNode, ev: AudioWorkletNodeEventMap[K]) => any)
        • (this: AudioWorkletNode, ev: AudioWorkletNodeEventMap[K]): any
        • Parameters

          • this: AudioWorkletNode
          • ev: AudioWorkletNodeEventMap[K]

          Returns any

    • Optional options: boolean | EventListenerOptions

    Returns void

  • Parameters

    • type: string
    • listener: EventListenerOrEventListenerObject
    • Optional options: boolean | EventListenerOptions

    Returns void

  • Call setPosition to update the local Listener's position within the virtual audio space. The position will be sent over the WebRTC PeerConnection along with audio-data. This function can only be used if setupHRTF was called with a non-null MetadataCallback function.

    Example

    let md = {};
    md.x = 1.5;
    md.y = -2;
    md.o = 0.785;
    listener.setPosition(md);

    Parameters

    • position: Metadata

      an associative array with members x, y, and o to indicate the position of the local Listener. x and y are in meters, and o is in radians.

    Returns void

© 2023 High Fidelity, Inc. | All rights reserved Terms of Service | Privacy Policy