Пример #1
0
        internal static void SetPosition(uint p)
        {
            bool pause = State == PlayerState.Playing;

            if (pause)
            {
                Pause();
            }
            position = p;
            for (int i = NumTracks - 1; i >= 0; i--)
            {
                var track = tracks[i];
                track.Init();
                uint elapsed = 0;
                while (!track.Stopped)
                {
                    ExecuteNext(i);
                    // elapsed == 400, delay == 4, p == 402
                    if (elapsed <= p && elapsed + track.Delay > p)
                    {
                        track.Delay -= (byte)(p - elapsed);
                        SoundMixer.StopAllChannels();
                        break;
                    }
                    elapsed    += track.Delay;
                    track.Delay = 0;
                }
            }
            if (pause)
            {
                Pause();
            }
        }
Пример #2
0
 internal static void Stop()
 {
     if (State == PlayerState.Stopped)
     {
         return;
     }
     State = PlayerState.Stopped;
     SoundMixer.StopAllChannels();
 }