public IEnumerable <int> TickIterator(int startPosition, ChannelChaser chaser, MessageDispatcher dispatcher) { #region Require if (startPosition < 0) { throw new ArgumentOutOfRangeException("startPosition", startPosition, "Start position out of range."); } #endregion IEnumerator <MidiEvent> enumerator = Iterator().GetEnumerator(); bool notFinished = enumerator.MoveNext(); IMidiMessage message; while (notFinished && enumerator.Current.AbsoluteTicks < startPosition) { message = enumerator.Current.MidiMessage; if (message.MessageType == MessageType.Channel) { chaser.Process((ChannelMessage)message); } else if (message.MessageType == MessageType.Meta) { dispatcher.Dispatch(message); } notFinished = enumerator.MoveNext(); } chaser.Chase(); int ticks = startPosition; while (notFinished) { while (ticks < enumerator.Current.AbsoluteTicks) { yield return(ticks); ticks++; } yield return(ticks); while (notFinished && enumerator.Current.AbsoluteTicks == ticks) { dispatcher.Dispatch(enumerator.Current.MidiMessage); notFinished = enumerator.MoveNext(); } ticks++; } }
public IEnumerable <int> TickIterator(int startPosition, ChannelChaser chaser, MessageDispatcher dispatcher) { var enumerator = Iterator().GetEnumerator(); bool notFinished = enumerator.MoveNext(); while (notFinished && enumerator.Current.AbsoluteTicks < startPosition) { var cur = enumerator.Current; if (cur.MessageType == MessageType.Channel) { chaser.Process((ChannelMessage)cur.Clone()); } else if (cur.MessageType == MessageType.Meta) { dispatcher.Dispatch(cur.Clone()); } notFinished = enumerator.MoveNext(); } chaser.Chase(); int ticks = startPosition; while (notFinished) { while (ticks < enumerator.Current.AbsoluteTicks) { yield return(ticks); ticks++; } yield return(ticks); while (notFinished && enumerator.Current.AbsoluteTicks == ticks) { dispatcher.Dispatch(enumerator.Current.Clone()); notFinished = enumerator.MoveNext(); } ticks++; } }
public IEnumerable<int> TickIterator(int startPosition, ChannelChaser chaser, MessageDispatcher dispatcher) { var enumerator = Iterator().GetEnumerator(); bool notFinished = enumerator.MoveNext(); while (notFinished && enumerator.Current.AbsoluteTicks < startPosition) { var cur = enumerator.Current; if (cur.MessageType == MessageType.Channel) { chaser.Process((ChannelMessage)cur.Clone()); } else if (cur.MessageType == MessageType.Meta) { dispatcher.Dispatch(cur.Clone()); } notFinished = enumerator.MoveNext(); } chaser.Chase(); int ticks = startPosition; while (notFinished) { while (ticks < enumerator.Current.AbsoluteTicks) { yield return ticks; ticks++; } yield return ticks; while (notFinished && enumerator.Current.AbsoluteTicks == ticks) { dispatcher.Dispatch(enumerator.Current.Clone()); notFinished = enumerator.MoveNext(); } ticks++; } }
public IEnumerable <int> ReaderIterator(int startPosition, ChannelChaser chaser, MessageDispatcher dispatcher) { if (startPosition < 0) { throw new ArgumentOutOfRangeException("startPosition", startPosition, "Start position out of range."); } IEnumerator <MidiEvent> enumerator = this.Iterator().GetEnumerator(); bool notFinished = enumerator.MoveNext(); int ticks = 0; while (notFinished) { IMidiMessage message = enumerator.Current.MidiMessage; if (message.MessageType == MessageType.Channel) { chaser.Process((ChannelMessage)message); } else if (message.MessageType == MessageType.Meta) { dispatcher.Dispatch(message); } ticks++; notFinished = enumerator.MoveNext(); } chaser.Chase(); yield return(ticks); }
public IEnumerable<int> DispatcherIterator(MessageDispatcher dispatcher) { IEnumerator<MidiEvent> enumerator = Iterator().GetEnumerator(); while(enumerator.MoveNext()) { yield return enumerator.Current.AbsoluteTicks; dispatcher.Dispatch(enumerator.Current.MidiMessage); } }
public IEnumerable <int> DispatcherIterator(MessageDispatcher dispatcher) { var enumerator = Iterator().GetEnumerator(); while (enumerator.MoveNext()) { yield return(enumerator.Current.AbsoluteTicks); dispatcher.Dispatch(enumerator.Current.Clone()); } }
public IEnumerable <int> DispatcherIterator(MessageDispatcher dispatcher) { IEnumerator <MidiEvent> enumerator = Iterator().GetEnumerator(); while (enumerator.MoveNext()) { yield return(enumerator.Current.AbsoluteTicks); dispatcher.Dispatch(this, enumerator.Current.MidiMessage); } }
public IEnumerable<int> TickIterator(int startPosition, ChannelChaser chaser, MessageDispatcher dispatcher) { #region Require if(startPosition < 0) { throw new ArgumentOutOfRangeException("startPosition", startPosition, "Start position out of range."); } #endregion IEnumerator<MidiEvent> enumerator = Iterator().GetEnumerator(); bool notFinished = enumerator.MoveNext(); IMidiMessage message; while(notFinished && enumerator.Current.AbsoluteTicks < startPosition) { message = enumerator.Current.MidiMessage; if(message.MessageType == MessageType.Channel) { chaser.Process((ChannelMessage)message); } else if(message.MessageType == MessageType.Meta) { dispatcher.Dispatch(message); } notFinished = enumerator.MoveNext(); } chaser.Chase(); int ticks = startPosition; while(notFinished) { while(ticks < enumerator.Current.AbsoluteTicks) { yield return ticks; ticks++; } yield return ticks; while(notFinished && enumerator.Current.AbsoluteTicks == ticks) { dispatcher.Dispatch(enumerator.Current.MidiMessage); notFinished = enumerator.MoveNext(); } ticks++; } }