Пример #1
0
        public Sequencer()
        {
            dispatcher.MetaMessageDispatched += delegate(object sender, MetaMessageEventArgs e)
            {
                if (e.Message.MetaType == MetaType.EndOfTrack)
                {
                    tracksPlayingCount--;

                    if (tracksPlayingCount == 0)
                    {
                        Stop();

                        OnPlayingCompleted(EventArgs.Empty);
                    }
                }
                else
                {
                    clock.Process(e.Message);
                }
            };

            dispatcher.ChannelMessageDispatched += delegate(object sender, ChannelMessageEventArgs e)
            {
                stopper.Process(e.Message);
            };

            clock.Tick += delegate(object sender, EventArgs e)
            {
                lock (lockObject)
                {
                    if (!playing)
                    {
                        return;
                    }

                    foreach (IEnumerator <int> enumerator in enumerators)
                    {
                        enumerator.MoveNext();
                    }
                }
            };
            ori_clock = clock;
        }
Пример #2
0
 public void resumeOriginalclock()
 {
     this.clock = this.ori_clock;
 }