ChannelAudioComponent
A component that configures channel-based rendering of sounds from an entity.
Declaration
struct ChannelAudioComponentOverview
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.
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.
entity.channelAudio?.gain = -10Channel audio sources are well suited to play back sounds not associated with any visual elements in a scene.