/// <summary>
 /// Scrubs the currently-playing track to a specific point in its timeline.
 /// </summary>
 /// <param name="time">How far along to scrub the track, in seconds</param>
 public void Scrub(float time)
 {
     if (PlayingTrack != null)
     {
         time = Mathf.Min(time, PlayingTrack.LengthInSeconds);
         CurrentSpeaker.SetPosition(PlayingTrack, PlayingTrack.SecondsToSamples(time));
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Plays the given track starting at the given play position.
        /// </summary>
        /// <param name="track">The track to play</param>
        /// <param name="time">The time to play the track at, in seconds</param>
        /// <param name="numberOfLoops">The number of times to loop the track. Set to 0 for endless play.</param>
        public void PlayAtPoint(MusicTrack track, float time, int numberOfLoops)
        {
            RemovePauseState();
            Stop();
            SetTrack(track);

            IntroSource.clip = PlayingTrack.IntroClip;
            LoopSource.clip  = PlayingTrack.LoopClip;

            PlayAtPosition(PlayingTrack.SecondsToSamples(time), numberOfLoops);
        }