Exemplo n.º 1
0
        public void Convert(SmfContainer input)
        {
            this.output = new List <SequenceItem>();
            this.info   = new SequenceInfo()
            {
                Resolution    = input.Resolution,
                EndOfTick     = input.MaxTick,
                LoopBeginTick = this.DetectLoopBegin(input)
            };

            this.ResetHandles();

            foreach (Event @event in input.Tracks.SelectMany(t => t.Events).OrderBy(e => e.Tick))
            {
                this.nowTick = @event.Tick;

                if (@event is MidiEvent)
                {
                    this.ConvertHandles((MidiEvent)@event);
                }
                else if (@event is MetaEvent)
                {
                    MetaEvent metaevent = (MetaEvent)@event;
                    if (metaevent.MetaType == MetaType.Tempo)
                    {
                        this.AddTempo(metaevent.GetTempo());
                    }
                }
            }
        }
Exemplo n.º 2
0
        public Sequencer(IEnumerable<SequenceItem> handles, SequenceInfo info)
        {
            if (handles == null)
                throw new ArgumentNullException("handles");

            this.handles = new List<SequenceItem>(handles);
            this.info = info;

            this.tick = -info.Resolution;

            this.RecalcTickTime();
        }
Exemplo n.º 3
0
        public Sequencer(IEnumerable <SequenceItem> handles, SequenceInfo info)
        {
            if (handles == null)
            {
                throw new ArgumentNullException("handles");
            }

            this.handles = new List <SequenceItem>(handles);
            this.info    = info;

            this.tick = -info.Resolution;

            this.RecalcTickTime();
        }
Exemplo n.º 4
0
        public void Convert(SmfContainer input)
        {
            this.output = new List<SequenceItem>();
            this.info = new SequenceInfo()
            {
                Resolution = input.Resolution,
                EndOfTick = input.MaxTick,
                LoopBeginTick = this.DetectLoopBegin(input)
            };

            this.ResetHandles();

            foreach (Event @event in input.Tracks.SelectMany(t => t.Events).OrderBy(e => e.Tick))
            {
                this.nowTick = @event.Tick;

                if (@event is MidiEvent)
                    this.ConvertHandles((MidiEvent)@event);
                else if (@event is MetaEvent)
                {
                    MetaEvent metaevent = (MetaEvent)@event;
                    if (metaevent.MetaType == MetaType.Tempo)
                        this.AddTempo(metaevent.GetTempo());
                }
            }
        }