public void StopSFX() { #if UNITY_EDITOR || UNITY_STANDALONE SFX.Stop(); #endif #if !UNITY_EDITOR && UNITY_ANDROID AndroidNativeAudio.stop(currentSFXStreamID); #endif }
public void StopSFX(int id) { #if UNITY_EDITOR || UNITY_STANDALONE SFX.Stop(); #endif #if !UNITY_EDITOR && UNITY_ANDROID AndroidNativeAudio.stop(id); #endif }
protected virtual void Handler_StopLoopedEvent(object sender, GameEventArgs e) { Dictionary <string, int> soundsToSave = new Dictionary <string, int>(); foreach (var s in loopedSounds) { if (s.Key != e.type) { AndroidNativeAudio.stop(s.Value); soundsToSave.Add(s.Key, s.Value); } } loopedSounds = soundsToSave; }
void ModifySound() { // These aren't necessary, but show how you could work with a loaded sound. AndroidNativeAudio.pause(SoundID); AndroidNativeAudio.resume(SoundID); AndroidNativeAudio.stop(SoundID); AndroidNativeAudio.pauseAll(); AndroidNativeAudio.resumeAll(); AndroidNativeAudio.setVolume(SoundID, 0.5f); AndroidNativeAudio.setLoop(SoundID, 3); AndroidNativeAudio.setPriority(SoundID, 5); AndroidNativeAudio.setRate(SoundID, 0.75f); }
IEnumerator FadeOutSFXCorou(int id, float t) { float tt = 0; if (t != 0) { do { yield return(null); tt += TimeManager.Instance.UnscaledDeltaTime / t; AndroidNativeAudio.setVolume(id, Mathf.Lerp(sfxVolume, 0, tt)); } while (tt < 1); } AndroidNativeAudio.stop(id); }