init
TypeScriptstatic init(gain?: number): ChannelAudioComponentSwift declarationinit(gain: Audio.Decibel = .zero)Configure the behavior of a channel audio source. - Parameter gain: The overall level for all sounds emitted from an entity.
struct · iOS 18.0+ · SDK 27.1
struct ChannelAudioComponentA 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.
static init(gain?: number): ChannelAudioComponentSwift declarationinit(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 gain(): numberSwift declarationvar 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 gain(value: number)Swift declarationvar 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.
No declarations were skipped in this snapshot.