One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

ChannelAudioComponent

struct · iOS 18.0+ · SDK 27.1

struct ChannelAudioComponent

A component that configures channel-based rendering of sounds from an entity. Channel audio sources route the audio resource's channels directly to the device's output without any spatialization or reverberation applied. Neither the position nor orientation of the entity is taken into consideration for channel rendering. For example, the left channel is heard from the left, and the right channel is heard from the right, regardless of where the user is oriented. The channels of multichannel audio resources are panned according to their channel layout, including rear channels. ```swift let entity = Entity() let resource = try AudioFileResource.load(named: "MyAudioFile") entity.channelAudio = ChannelAudioComponent() entity.playAudio(resource) ``` The `ChannelAudioComponent` 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. ```swift entity.channelAudio?.gain = -10 ``` Channel audio sources are well suited to play back sounds not associated with any visual elements in a scene.

Members (3)

init · iOS 18.0+

init

TypeScript
static init(gain?: number): ChannelAudioComponent
Swift declaration
init(gain: Audio.Decibel = .zero)

Configure the behavior of a channel audio source. - Parameter gain: The overall level for all sounds emitted from an entity.

get · iOS 18.0+

gain

TypeScript
get gain(): number
Swift declaration
var gain: Audio.Decibel { get set }

The overall level for all sounds emitted from an entity. In relative Decibels, in the range `-.infinity ... .zero` where `.zero` is the default.

set · iOS 18.0+

gain

TypeScript
set gain(value: number)
Swift declaration
var gain: Audio.Decibel { get set }

The overall level for all sounds emitted from an entity. In relative Decibels, in the range `-.infinity ... .zero` where `.zero` is the default.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →