Contents

AmbientAudioComponent

A component that configures the ambient rendering of sounds from an entity.

Declaration

struct AmbientAudioComponent

Overview

Ambient audio sources emit each channel of an audio resource from an angle projected from the entity, without reverberation. Ambient audio sources take into account the relative orientation of the source and the listener. Position is not taken into account; the channels do not get louder as the user moves toward them.

The audio resource’s front channels (e.g., mono, center) are projected into the entity’s -Z direction, with the rear channels projected into +Z. The left channels are laid out in -X and the right channels are laid out in +X.

let entity = Entity()
let resource = try AudioFileResource.load(named: "MyAudioFile")
entity.ambientAudio = AmbientAudioComponent()
entity.playAudio(resource)

The AmbientAudioComponent allows you to set the overall level of all sounds played from the entity with the gain property, in relative Decibels, in the range -.infinity ... .zero where -infinity is silent and .zero is nominal.

entity.ambientAudio?.gain = -10

Ambient audio sources are well suited to play back multichannel content which captures the acoustics of its originating environment in the recording process (e.g., multichannel field recordings of outdoor environments).

Topics

Initializers

Instance Properties

See Also

Audio source components