Description
The AirAbsorption
property of the Sandbox.Audio.Mixer
class determines how much the air absorbs energy from the sound. This property is useful for simulating realistic audio environments where sound energy diminishes over distance due to air absorption.
Usage
The AirAbsorption
property is a float
value that ranges from 0 to 1. A value of 0 means no air absorption, while a value of 1 means maximum air absorption. This property can be adjusted to achieve the desired level of sound attenuation due to air absorption in your audio environment.
Example
// Create a new audio mixer
Mixer audioMixer = new Mixer();
// Set the air absorption to a moderate level
audioMixer.AirAbsorption = 0.5f;
// This will cause the sound to lose energy as it travels through the air
// The higher the value, the more the sound is absorbed by the air