Example #1
0
        public static IEnumerable <MIDIEvent> EventInjector(IEnumerable <MIDIEvent> sequence, Func <MIDIEvent> generator)
        {
            MIDIEvent nextGenerated = generator().Clone();

            foreach (var _e in sequence)
            {
                var e = _e.Clone();
                while (nextGenerated.DeltaTime < e.DeltaTime)
                {
                    e.DeltaTime -= nextGenerated.DeltaTime;
                    yield return(nextGenerated);

                    nextGenerated = generator().Clone();
                }
                nextGenerated.DeltaTime -= e.DeltaTime;
                yield return(e);
            }
        }
Example #2
0
        public void Write(MIDIEvent e)
        {
            var data = e.GetDataWithDelta();

            writer.Write(data, 0, data.Length);
        }