Exemple #1
0
        // Token: 0x060033BA RID: 13242 RVA: 0x001486D0 File Offset: 0x001468D0
        public void Write(MidiEvent midiEvent, MidiWriter writer, WritingSettings settings, bool writeStatusByte)
        {
            if (writeStatusByte)
            {
                writer.WriteByte(byte.MaxValue);
            }
            UnknownMetaEvent unknownMetaEvent = midiEvent as UnknownMetaEvent;
            byte             statusByte;

            if (unknownMetaEvent != null)
            {
                statusByte = unknownMetaEvent.StatusByte;
            }
            else
            {
                Type type = midiEvent.GetType();
                if (!StandardEventTypes.Meta.TryGetStatusByte(type, out statusByte))
                {
                    EventTypesCollection customMetaEventTypes = settings.CustomMetaEventTypes;
                    if (customMetaEventTypes != null)
                    {
                        bool flag = !customMetaEventTypes.TryGetStatusByte(type, out statusByte);
                    }
                }
            }
            writer.WriteByte(statusByte);
            int size = midiEvent.GetSize(settings);

            writer.WriteVlqNumber(size);
            midiEvent.Write(writer, settings);
        }
Exemple #2
0
        public void Write(MidiEvent midiEvent, MidiWriter writer, WritingSettings settings, bool writeStatusByte)
        {
            if (writeStatusByte)
            {
                writer.WriteByte(EventStatusBytes.Global.Meta);
            }

            //

            byte statusByte;

            var unknownMetaEvent = midiEvent as UnknownMetaEvent;

            if (unknownMetaEvent != null)
            {
                statusByte = unknownMetaEvent.StatusByte;
            }
            else
            {
                var eventType = midiEvent.GetType();
                if (!StandardEventTypes.Meta.TryGetStatusByte(eventType, out statusByte) && settings.CustomMetaEventTypes?.TryGetStatusByte(eventType, out statusByte) != true)
                {
                    Debug.Fail($"Unable to write the {eventType} event.");
                }
            }

            writer.WriteByte(statusByte);

            //

            var contentSize = midiEvent.GetSize(settings);

            writer.WriteVlqNumber(contentSize);
            midiEvent.Write(writer, settings);
        }
Exemple #3
0
        public void Write(MidiEvent midiEvent, MidiWriter writer, WritingSettings settings, bool writeStatusByte)
        {
            VerifyEvent(midiEvent);

            //

            if (writeStatusByte)
            {
                var eventType = midiEvent.GetType();

                byte statusByte;
                if (!StandardEventTypes.SysEx.TryGetStatusByte(eventType, out statusByte))
                {
                    Debug.Fail($"Unable to write the {eventType} event.");
                }

                writer.WriteByte(statusByte);
            }

            //

            var contentSize = midiEvent.GetSize(settings);

            writer.WriteVlqNumber(contentSize);
            midiEvent.Write(writer, settings);
        }
Exemple #4
0
        public int CalculateSize(MidiEvent midiEvent, WritingSettings settings, bool writeStatusByte)
        {
            VerifyEvent(midiEvent);

            //

            return((writeStatusByte ? 1 : 0) + midiEvent.GetSize(settings));
        }
Exemple #5
0
        public int CalculateSize(MidiEvent midiEvent, WritingSettings settings, bool writeStatusByte)
        {
            VerifyEvent(midiEvent);

            //

            var contentSize = midiEvent.GetSize(settings);

            return((writeStatusByte ? 1 : 0) + 1 + contentSize.GetVlqLength() + contentSize);
        }
Exemple #6
0
        // Token: 0x060033BF RID: 13247 RVA: 0x00148774 File Offset: 0x00146974
        public void Write(MidiEvent midiEvent, MidiWriter writer, WritingSettings settings, bool writeStatusByte)
        {
            if (writeStatusByte)
            {
                Type type = midiEvent.GetType();
                byte value;
                StandardEventTypes.SysEx.TryGetStatusByte(type, out value);
                writer.WriteByte(value);
            }
            int size = midiEvent.GetSize(settings);

            writer.WriteVlqNumber(size);
            midiEvent.Write(writer, settings);
        }
        public int CalculateSize(MidiEvent midiEvent, WritingSettings settings, bool writeStatusByte)
        {
            if (midiEvent == null)
            {
                throw new ArgumentNullException(nameof(midiEvent));
            }

            if (!(midiEvent is ChannelEvent))
            {
                throw new ArgumentException("Event is not Channel event.", nameof(midiEvent));
            }

            //

            return((writeStatusByte ? 1 : 0) + midiEvent.GetSize());
        }
        public void Write(MidiEvent midiEvent, MidiWriter writer, WritingSettings settings, bool writeStatusByte)
        {
            if (midiEvent == null)
            {
                throw new ArgumentNullException(nameof(midiEvent));
            }

            if (!(midiEvent is MetaEvent))
            {
                throw new ArgumentException("Event is not Meta event.", nameof(midiEvent));
            }

            //

            if (writeStatusByte)
            {
                writer.WriteByte(EventStatusBytes.Global.Meta);
            }

            //

            byte statusByte;

            var unknownMetaEvent = midiEvent as UnknownMetaEvent;

            if (unknownMetaEvent != null)
            {
                statusByte = unknownMetaEvent.StatusByte;
            }
            else
            {
                var eventType = midiEvent.GetType();
                if (!StandardEventTypes.Meta.TryGetStatusByte(eventType, out statusByte) && settings.CustomMetaEventTypes?.TryGetStatusByte(eventType, out statusByte) != true)
                {
                    throw new InvalidOperationException($"Unable to write the {eventType} event.");
                }
            }

            writer.WriteByte(statusByte);

            //

            var contentSize = midiEvent.GetSize();

            writer.WriteVlqNumber(contentSize);
            midiEvent.Write(writer, settings);
        }
Exemple #9
0
        public int CalculateSize(MidiEvent midiEvent, WritingSettings settings, bool writeStatusByte)
        {
            if (midiEvent == null)
            {
                throw new ArgumentNullException(nameof(midiEvent));
            }

            if (!(midiEvent is SysExEvent))
            {
                throw new ArgumentException("Event is not SysEx event.", nameof(midiEvent));
            }

            //

            var contentSize = midiEvent.GetSize();

            return((writeStatusByte ? 1 : 0) + contentSize.GetVlqLength() + contentSize);
        }
Exemple #10
0
        public void Write(MidiEvent midiEvent, MidiWriter writer, WritingSettings settings, bool writeStatusByte)
        {
            if (midiEvent == null)
            {
                throw new ArgumentNullException(nameof(midiEvent));
            }

            var sysExEvent = midiEvent as SysExEvent;

            if (sysExEvent == null)
            {
                throw new ArgumentException("Event is not SysEx event.", nameof(midiEvent));
            }

            //

            if (writeStatusByte)
            {
                var eventType = midiEvent.GetType();

                byte statusByte;
                if (!StandardEventTypes.SysEx.TryGetStatusByte(eventType, out statusByte))
                {
                    throw new InvalidOperationException($"Unable to write the {eventType} event.");
                }

                writer.WriteByte(statusByte);
            }

            //

            var contentSize = midiEvent.GetSize();

            writer.WriteVlqNumber(contentSize);
            midiEvent.Write(writer, settings);
        }
Exemple #11
0
        // Token: 0x060033C0 RID: 13248 RVA: 0x001487B8 File Offset: 0x001469B8
        public int CalculateSize(MidiEvent midiEvent, WritingSettings settings, bool writeStatusByte)
        {
            int size = midiEvent.GetSize(settings);

            return((writeStatusByte ? 1 : 0) + size.GetVlqLength() + size);
        }