API

Class AudioEngineV2Abstract

Abstract base class for v2 audio engines.

A v2 audio engine based on the WebAudio API can be created with the CreateAudioEngineAsync function.

Implements

Index
currentTime: number

The elapsed time since the audio engine was started, in seconds.

The spatial audio listener properties for the audio engine.

  • Each audio engine has exactly one listener.

The main output node.

  • This is the last node in the audio graph before the audio is sent to the speakers.

The current state of the audio engine.

Possible values are:

  • "closed": The audio engine has been closed.
  • "interrupted": The audio engine has been interrupted and is not running.
  • "running": The audio engine is running normally.
  • "suspended": The audio engine is suspended and is not running.
volume: number

The output volume of the audio engine.

  • Sets the audio output volume with optional ramping. If the duration is 0 then the volume is set immediately, otherwise it is ramped to the new value over the given duration using the given shape. If a ramp is already in progress then the volume is not set and an error is thrown.

    Parameters

    • value: number

      The value to set the volume to.

    • Optionaloptions: Partial<IAudioParameterRampOptions>

      The options to use for ramping the volume change.

    Returns void

  • Unlocks the audio engine if it is locked.

    • Note that the returned promise may already be resolved if the audio engine is already unlocked.

    Returns Promise<void>

    A promise that is resolved when the audio engine is unlocked.