private void _PauseNow() { if (playScheduledTimeDsp > 0.0) { dspTimeRemainingAtPause = playScheduledTimeDsp - AudioSettings.dspTime; ScheduledPlayingAtDspTime = 9000000000.0; } _PauseAudioSources(); if (!pauseWithFadeOutRequested) { return; } pauseWithFadeOutRequested = false; primaryFader.Set0(); }
protected override void Awake() { base.Awake(); if (primaryFader == null) { primaryFader = new AudioFader(); } else { primaryFader.Set0(); } if (secondaryFader == null) { secondaryFader = new AudioFader(); } else { secondaryFader.Set0(); } if (audioSource1 == null) { var components = GetComponents <AudioSource>(); if (components.Length == 0) { Debug.LogError("AudioObject does not have an AudioSource component!"); } else { audioSource1 = components[0]; if (components.Length >= 2) { audioSource2 = components[1]; } } } else if ((bool)audioSource2 && areSources1And2Swapped) { SwitchAudioSources(); } audioMixerGroup = PrimaryAudioSource.outputAudioMixerGroup; _Set0(); audioController = AudioController.Instance; }