Exemple #1
0
 private void _Stop()
 {
     primaryFader.Set0();
     secondaryFader.Set0();
     PrimaryAudioSource.Stop();
     if ((bool)SecondaryAudioSource)
     {
         SecondaryAudioSource.Stop();
     }
     paused = false;
     primaryAudioSourcePaused   = false;
     secondaryAudioSourcePaused = false;
 }
Exemple #2
0
 private void _PlayDelayed(float delay)
 {
     if (!(bool)PrimaryAudioSource.clip)
     {
         Debug.LogError("audio.clip == null in " + gameObject.name);
     }
     else
     {
         PrimaryAudioSource.PlayDelayed(delay);
         playScheduledTimeDsp = -1.0;
         playStartTimeLocal   = AudioObjectTime + delay;
         playStartTimeSystem  = AudioController.SystemTime + delay;
         _OnPlay();
     }
 }
Exemple #3
0
 private void _PlayScheduled(double dspTime)
 {
     if (!(bool)PrimaryAudioSource.clip)
     {
         Debug.LogError("audio.clip == null in " + gameObject.name);
     }
     else
     {
         playScheduledTimeDsp = dspTime;
         var num = dspTime - AudioSettings.dspTime;
         playStartTimeLocal  = num + AudioObjectTime;
         playStartTimeSystem = num + AudioController.SystemTime;
         PrimaryAudioSource.PlayScheduled(dspTime);
         _OnPlay();
     }
 }
Exemple #4
0
 private void _PauseAudioSources()
 {
     if (PrimaryAudioSource.isPlaying)
     {
         primaryAudioSourcePaused = true;
         PrimaryAudioSource.Pause();
     }
     else
     {
         primaryAudioSourcePaused = false;
     }
     if ((bool)SecondaryAudioSource && SecondaryAudioSource.isPlaying)
     {
         secondaryAudioSourcePaused = true;
         SecondaryAudioSource.Pause();
     }
     else
     {
         secondaryAudioSourcePaused = false;
     }
 }
Exemple #5
0
 private void _UnpauseNow()
 {
     paused = false;
     if ((bool)SecondaryAudioSource && secondaryAudioSourcePaused)
     {
         SecondaryAudioSource.Play();
     }
     if (dspTimeRemainingAtPause > 0.0 && primaryAudioSourcePaused)
     {
         var time = AudioSettings.dspTime + dspTimeRemainingAtPause;
         playStartTimeSystem = AudioController.SystemTime + dspTimeRemainingAtPause;
         PrimaryAudioSource.PlayScheduled(time);
         ScheduledPlayingAtDspTime = time;
         dspTimeRemainingAtPause   = -1.0;
     }
     else
     {
         if (!primaryAudioSourcePaused)
         {
             return;
         }
         PrimaryAudioSource.Play();
     }
 }