Exemple #1
0
        public MidiEvent Read(MidiReader reader, ReadingSettings settings, byte currentStatusByte)
        {
            var statusByte = reader.ReadByte();
            var size       = reader.ReadVlqNumber();

            //

            Type eventType;
            var  midiEvent = TryGetEventType(settings.CustomMetaEventTypes, statusByte, out eventType)
                ? (MetaEvent)Activator.CreateInstance(eventType)
                : new UnknownMetaEvent(statusByte);

            //

            var readerPosition = reader.Position;

            midiEvent.Read(reader, settings, size);

            var bytesRead   = reader.Position - readerPosition;
            var bytesUnread = size - bytesRead;

            if (bytesUnread > 0)
            {
                reader.Position += bytesUnread;
            }

            return(midiEvent);
        }
        // Token: 0x060033A7 RID: 13223 RVA: 0x00148610 File Offset: 0x00146810
        public MidiEvent Read(MidiReader reader, ReadingSettings settings, byte currentStatusByte)
        {
            int        size = reader.ReadVlqNumber();
            string     typeName;
            SysExEvent sysExEvent = StandardEventTypes.SysEx.TryGetType(currentStatusByte, out typeName) ? this.GetEvent(typeName) : null;

            sysExEvent.Read(reader, settings, size);
            return(sysExEvent);
        }
        // Token: 0x060033A3 RID: 13219 RVA: 0x00148300 File Offset: 0x00146500
        public MidiEvent Read(MidiReader reader, ReadingSettings settings, byte currentStatusByte)
        {
            byte   b   = reader.ReadByte();
            int    num = reader.ReadVlqNumber();
            string typeName;

            MetaEventReader.TryGetEventType(b, out typeName);
            MetaEvent @event   = this.GetEvent(typeName, b);
            long      position = reader.Position;

            @event.Read(reader, settings, num);
            long num2 = reader.Position - position;
            long num3 = (long)num - num2;

            if (num3 > 0L)
            {
                reader.Position += num3;
            }
            return(@event);
        }
        public MidiEvent Read(MidiReader reader, ReadingSettings settings, byte currentStatusByte)
        {
            var size = reader.ReadVlqNumber();

            //

            Type eventType;
            var  midiEvent = StandardEventTypes.SysEx.TryGetType(currentStatusByte, out eventType)
                ? (SysExEvent)Activator.CreateInstance(eventType)
                : null;

            if (midiEvent == null)
            {
                throw new InvalidOperationException("Unknown SysEx event.");
            }

            //

            midiEvent.Read(reader, settings, size);
            return(midiEvent);
        }