Get Progress
What it does: Returns the progress of the given sound, which is a float from 0 to 1 and returns an AudioError (see Possible Errors), showing wheter and how getting the current progress of the sound failed.
- DOES_NOT_EXIST
- MISSING_WRAPPER
- MISSING_SOURCE
- MISSING_CLIP
How to call it:
SoundNameis thenamewe have given the sound we want to get the progress fromProgressis thevariablethe progress will be copied intofloat.NaNon failureChildis theChildTypethat we want to call this method on
string soundName = "SoundName";
float progress = float.NaN;
ChildType child = ChildType.PARENT;
AudioError error = am.GetProgress(soundName, out progress, child);
if (error != AudioError.OK) {
Debug.Log("Getting progress of the sound called: " + soundName + " failed with error id: " + error);
}
else {
Debug.Log("Getting progress of the sound called: " + soundName + " with the progress being: " + (progress * 100).ToString("0.00") + "% succesfull");
}
Alternatively you can call the methods with less paramters as some of them have default arguments.
string soundName = "SoundName";
float progress = float.NaN;
AudioError error = am.GetProgress(soundName, out progress);
if (error != AudioError.OK) {
Debug.Log("Getting progress of the sound called: " + soundName + " failed with error id: " + error);
}
else {
Debug.Log("Getting progress of the sound called: " + soundName + " with the progress being: " + (progress * 100).ToString("0.00") + "% succesfull");
}
When to use it: When you want to get the progress of a sound for an animation or to track once it’s finished to start a new sound.