/// Updates the |soundfield| with given |id| and its properties. /// @note This should only be called from the main Unity thread. public static void UpdateAudioSoundfield(int id, GvrAudioSoundfield soundfield) { if (initialized) { SetSourceBypassRoomEffects(id, soundfield.bypassRoomEffects); } }
public static IEnumerator fadeOut(this GvrAudioSoundfield audioSource, float duration) { float startVolume = audioSource.volume; float counter = 0f; while (counter < duration) { audioSource.volume = Mathf.Lerp(startVolume, 0, counter / duration); counter += Time.deltaTime; yield return(new WaitForEndOfFrame()); } audioSource.volume = 0; audioSource.Stop(); }
private IEnumerator FadeInAmbiAudio(GvrAudioSoundfield audioSoundField, float openTimeSpreader) { //Debug.Log("FadeIn!"); float minMask = 0.0f; float maxMask = gvrTargetVolume; float currMask = minMask; while (currMask < maxMask) { audioSoundField.volume = Mathf.Lerp(minMask, maxMask, currMask); currMask += openTimeSpreader * Time.deltaTime; yield return(null); } audioSoundField.volume = gvrTargetVolume; }
private IEnumerator FadeOutAmbiAudio(GvrAudioSoundfield audioSoundField, float closeTimeSpreader) { float minMask = 0.0f; float maxMask = gvrTargetVolume; float currMask = audioSoundField.volume; while (currMask > minMask && cancelBlink == false) { audioSoundField.volume = Mathf.Lerp(minMask, maxMask, currMask); currMask -= closeTimeSpreader * Time.deltaTime; yield return(null); } audioSoundField.volume = minMask; audioSoundField.Stop(); }
// Use this for initialization void Start() { soundfield = GetComponent <GvrAudioSoundfield> (); }