Description
The IsLoaded
property of the SoundFile
class indicates whether the sound file has been successfully loaded into memory. This property returns a boolean value, where true
signifies that the sound is loaded and ready for use, while false
indicates that the sound is not yet loaded or failed to load.
Usage
To check if a sound file is loaded, access the IsLoaded
property on an instance of SoundFile
. This is useful for ensuring that the sound is available before attempting to play it or perform operations that require the sound to be loaded.
Example
// Example of using the IsLoaded property
SoundFile sound = SoundFile.Load("path/to/soundfile.wav");
if (sound.IsLoaded)
{
// Sound is loaded, safe to use
// Perform operations with the sound
}
else
{
// Handle the case where the sound is not loaded
// Perhaps log an error or attempt to reload
}