Ejemplo n.º 1
0
        private static void UpdateEventsToCopyToNextPart(List <TimedEvent> eventsToCopyToNextPart, TimedEvent timedEvent)
        {
            var eventType = timedEvent.Event.EventType;
            var matched   = false;

            for (var i = 0; i < eventsToCopyToNextPart.Count && !matched; i++)
            {
                var existingTimedEvent = eventsToCopyToNextPart[i];
                if (existingTimedEvent.Event.EventType != eventType)
                {
                    continue;
                }

                matched = DefaultUpdatePredicates[eventType](timedEvent.Event, existingTimedEvent.Event);
                if (matched)
                {
                    eventsToCopyToNextPart.RemoveAt(i);
                    eventsToCopyToNextPart.Insert(i, timedEvent.Clone());
                }
            }

            if (!matched && DefaultUpdatePredicates.ContainsKey(eventType))
            {
                eventsToCopyToNextPart.Add(timedEvent.Clone());
            }
        }
Ejemplo n.º 2
0
        public void Clone()
        {
            var timedEvent = new TimedEvent(new NoteOnEvent((SevenBitNumber)100, (SevenBitNumber)50));

            Assert.IsTrue(TimedEventEquality.AreEqual(timedEvent, timedEvent.Clone(), true),
                          "Clone of a timed event doesn't equal to the original one.");
        }
Ejemplo n.º 3
0
        private static void UpdateEventsToCopyToNextPart(Dictionary <Type, TimedEvent> eventsToCopyToNextPart, TimedEvent timedEvent)
        {
            var midiEventType = timedEvent.Event.GetType();

            if (EventsTypesToCopyToNextPart.Contains(midiEventType))
            {
                eventsToCopyToNextPart[midiEventType] = timedEvent.Clone();
            }
        }