The Time
property of the Editor.SoundPlayer
class represents the current playback position of the sound being played. It is measured in seconds and allows you to get or set the playback time of the sound.
The Time
property of the Editor.SoundPlayer
class represents the current playback position of the sound being played. It is measured in seconds and allows you to get or set the playback time of the sound.
Use the Time
property to retrieve the current playback position or to set a new position for the sound playback. This can be useful for implementing features such as seeking to a specific time in the sound track.
To set the playback position, simply assign a new value to the Time
property. Ensure that the value is within the valid range of the sound's duration.
// Example of using the Time property // Create an instance of SoundPlayer SoundPlayer soundPlayer = new SoundPlayer(); // Start playing the sound soundPlayer.Play(); // Check the current playback time float currentTime = soundPlayer.Time; // Set the playback time to 10 seconds soundPlayer.Time = 10.0f; // Verify the new playback time float newTime = soundPlayer.Time;