예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TimerQueue"/> class.
 /// </summary>
 /// <param name="clock">The underlying high resolution clock.</param>
 /// <exception cref="System.ArgumentNullException">Argument clock is null</exception>
 public TimerQueue(IHighResolutionClock clock)
 {
     _clock = clock ?? throw new ArgumentNullException("clock");
     _event = new AutoResetEvent(false);
     _items = new ConcurrentTokenizedPriorityQueue <TimeSpan, Action <object, TimeSpan>, object>();
     _task  = Task.Factory.StartNew(Run, TaskCreationOptions.LongRunning);
 }
예제 #2
0
파일: TimerQueue.cs 프로젝트: Altaxo/Altaxo
		/// <summary>
		/// Initializes a new instance of the <see cref="TimerQueue"/> class.
		/// </summary>
		/// <param name="clock">The underlying high resolution clock.</param>
		/// <exception cref="System.ArgumentNullException">Argument clock is null</exception>
		public TimerQueue(IHighResolutionClock clock)
		{
			if (null == clock)
				throw new ArgumentNullException("clock");

			_clock = clock;
			_event = new AutoResetEvent(false);
			_items = new ConcurrentTokenizedPriorityQueue<TimeSpan, Action<object, TimeSpan>, object>();
			_task = Task.Factory.StartNew(Run, TaskCreationOptions.LongRunning);
		}
예제 #3
0
 public MidiSequencer(ISequencerEvent[] events, uint ppqn)
 {
     this.curIndex        = 0;
     this.ppqn            = 960;
     this.tempo           = 1000000; // One second per quarter note, 60bpm
     this.t0Midi          = 0;
     this.t0Tick          = 0;
     this.hrc             = HighResolutionClockFactory.GetHighResolutionClock();
     this.playing         = false;
     this.closing         = false;
     this.inPlayingLoop   = false;
     this.positionToTime  = 0;
     this.timeWhenStopped = 0;
     this.ppqn            = ppqn;
     this.events          = events;
     this.player          = new Thread(new ThreadStart(Player));
     this.player.Priority = ThreadPriority.Highest;
     this.playerRequest   = new object();
 }