Class ActiveAudioSourceAbstract

Represents a source for emitting audio. Audio can be played spatially (gun shot), or normally (music). Each audio source must have an AudioClip to play-back, and it can also have a position in the case of spatial (3D) audio.

Whether or not an audio source is spatial is controlled by the assigned AudioClip. The volume and the pitch of a spatial audio source is controlled by its position and the AudioListener position/direction/velocity.

Hierarchy

  • FrameworkObject
    • ActiveAudioSource

Constructors

  • Parameters

    • OptionalisInternalConstructor: boolean

    Returns ActiveAudioSource

Accessors

  • get attenuation(): number
  • Attenuation that controls how quickly does audio volume drop off as the listener moves further from the source.

    Returns number

  • set attenuation(value): void
  • Parameters

    • value: number

    Returns void

  • get isLooping(): boolean
  • Determines whether the audio clip should loop when it finishes playing.

    Returns boolean

  • set isLooping(value): void
  • Parameters

    • value: boolean

    Returns void

  • get minDistance(): number
  • Minimum distance at which audio attenuation starts. When the listener is closer to the source than this value, audio is heard at full volume. Once farther away the audio starts attenuating.

    Returns number

  • set minDistance(value): void
  • Parameters

    • value: number

    Returns void

  • get pitch(): number
  • Determines the pitch of the played audio. 1 is the default.

    Returns number

  • set pitch(value): void
  • Parameters

    • value: number

    Returns void

  • set priority(value): void
  • Determines the priority of the audio source. If more audio sources are playing than supported by the hardware, some might get disabled. By setting a higher priority the audio source is guaranteed to be disabled after sources with lower priority.

    Parameters

    • value: number

    Returns void

  • get time(): number
  • Determines the current time of playback. If playback hasn't yet started, it specifies the time at which playback will start at. The time is in seconds, in range [0, clipLength].

    Returns number

  • set time(value): void
  • Parameters

    • value: number

    Returns void

  • get velocity(): Immutable<Vector3>
  • Velocity of the source. Determines pitch in relation to AudioListener's position. Only relevant for spatial (3D) sources.

    Returns Immutable<Vector3>

  • set velocity(value): void
  • Parameters

    Returns void

  • get volume(): number
  • Volume of the audio played from this source, in [0, 1] range.

    Returns number

  • set volume(value): void
  • Parameters

    • value: number

    Returns void

Methods

  • Pauses the audio playback.

    Returns void

  • Stops audio playback, rewinding it to the start.

    Returns void