Unsubscribe Source Changed

What it does: Unsubscribes the previously via. SubscribeSourceChanged subscribed SourceChangedCallback, so that it will not be called anymore when the underlying AudioSourceWrapper of the subscribed sound has been changed and returns an AudioError (see Possible Errors), showing wheter and how unsubscribing the callback failed.

Possible Errors:

  • DOES_NOT_EXIST
  • MISSING_WRAPPER
  • MISSING_SOURCE
  • MISSING_CLIP
  • MISSING_PARENT
  • INVALID_PROGRESS
  • NOT_SUBSCRIBED

How to call it:

  • SoundName is the name we have given the sound we want to unsubscribe
  • Callback is the SourceChangedCallback(AudioSourceWrapper changedSource) that should not be called anymore
string soundName = "SoundName";
SourceChangedCallback callback = SoundChanged;

AudioError error = am.UnsubscribeProgressCoroutine(soundName, callback);
if (err != AudioError.OK) {
    Debug.Log("Unsubscribing to the callback of the sound called: " + soundName + " failed with error id: " + err);
}
else {
    Debug.Log("Unsubscribing to the callback of the sound called: " + soundName + " succesfull");
}

Callback method:

private void SoundChanged(AudioSourceWrapper changedSource) {
    // Do something.
}

When to use it: When you want to stop calling and detection of a previously subscribed SourceChangedCallback.