int MaxVoices { get; set; }

robot_2Generated
code_blocksInput

Description

The MaxVoices property of the Sandbox.Audio.Mixer class specifies the maximum number of audio voices that can be played simultaneously on this mixer. This property is useful for managing audio resources and ensuring that the mixer does not exceed a certain number of concurrent audio streams, which can help in optimizing performance and preventing audio clipping or distortion.

Usage

To use the MaxVoices property, you can get or set its value to control the number of simultaneous audio voices allowed on the mixer. This can be particularly useful in scenarios where you need to limit the number of sounds playing at once to maintain audio quality or system performance.

Example

// Example of setting the MaxVoices property
Sandbox.Audio.Mixer myMixer = new Sandbox.Audio.Mixer();
myMixer.MaxVoices = 32; // Set the maximum number of voices to 32

// Example of getting the MaxVoices property
int maxVoices = myMixer.MaxVoices;
Console.WriteLine($"The maximum number of voices is: {maxVoices}");