Description
The Default
property of the Sandbox.Audio.Mixer
class provides access to the default audio mixer instance. This mixer is used as a fallback for any audio that does not have a specific mixer assigned. It ensures that all audio has a mixer context, allowing for consistent audio processing and output.
Usage
Use the Default
property to retrieve the default mixer instance when you need to apply general audio processing or when no specific mixer is assigned to an audio source. This is particularly useful for ensuring that all audio in your application is processed through a mixer, even if it hasn't been explicitly assigned one.
Example
// Access the default audio mixer
Sandbox.Audio.Mixer defaultMixer = Sandbox.Audio.Mixer.Default;
// Example: Adjust the volume of the default mixer
defaultMixer.Volume = 0.8f;
// Example: Stop all sounds on the default mixer with a fade out
defaultMixer.StopAll(1.0f);