Description
The Volume
property of the SoundHandle
class represents the volume level of the sound. It is a floating-point value that determines how loud the sound is played. The value is typically between 0.0 (muted) and 1.0 (full volume), but it can exceed 1.0 for amplification.
Usage
To adjust the volume of a sound, you can set the Volume
property on an instance of SoundHandle
. This allows you to dynamically control the loudness of the sound during its playback.
Example
// Create a sound handle instance
SoundHandle soundHandle = new SoundHandle();
// Set the volume to 50%
soundHandle.Volume = 0.5f;
// Increase the volume to 75%
soundHandle.Volume = 0.75f;
// Mute the sound
soundHandle.Volume = 0.0f;
// Amplify the sound beyond normal range
soundHandle.Volume = 1.5f;