// Token: 0x060033B2 RID: 13234 RVA: 0x00148698 File Offset: 0x00146898
        public byte GetStatusByte(MidiEvent midiEvent)
        {
            byte number;

            StandardEventTypes.Channel.TryGetStatusByte(midiEvent.GetType(), out number);
            return(DataTypesUtilities.Combine((FourBitNumber)number, ((ChannelEvent)midiEvent).Channel));
        }
示例#2
0
        public void Write(MidiEvent midiEvent, MidiWriter writer, WritingSettings settings, bool writeStatusByte)
        {
            VerifyEvent(midiEvent);

            //

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

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

                var channel = ((ChannelEvent)midiEvent).Channel;

                var totalStatusByte = DataTypesUtilities.Combine((FourBitNumber)statusByte, channel);
                writer.WriteByte(totalStatusByte);
            }

            //

            midiEvent.Write(writer, settings);
        }
        public byte GetStatusByte(MidiEvent midiEvent)
        {
            if (midiEvent == null)
            {
                throw new ArgumentNullException(nameof(midiEvent));
            }

            var channelEvent = midiEvent as ChannelEvent;

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

            //

            byte statusByte;

            if (!StandardEventTypes.Channel.TryGetStatusByte(midiEvent.GetType(), out statusByte))
            {
                Debug.Fail($"No status byte defined for {midiEvent.GetType()}.");
            }

            var channel = channelEvent.Channel;

            return(DataTypesUtilities.Combine((FourBitNumber)statusByte, channel));
        }
        internal override void Write(MidiWriter writer, WritingSettings settings)
        {
            var component = Component;

            var componentValueMask = ComponentValueMasks[component];
            var componentValue     = ComponentValue & componentValueMask;

            var data = DataTypesUtilities.Combine((FourBitNumber)(byte)component,
                                                  (FourBitNumber)(byte)componentValue);

            writer.WriteByte(data);
        }
        public byte GetStatusByte(MidiEvent midiEvent)
        {
            byte statusByte;

            if (!StandardEventTypes.Channel.TryGetStatusByte(midiEvent.GetType(), out statusByte))
            {
                Debug.Fail($"No status byte defined for {midiEvent.GetType()}.");
            }

            return(DataTypesUtilities.Combine((FourBitNumber)statusByte,
                                              ((ChannelEvent)midiEvent).Channel));
        }
 // Token: 0x060033B0 RID: 13232 RVA: 0x00148648 File Offset: 0x00146848
 public void Write(MidiEvent midiEvent, MidiWriter writer, WritingSettings settings, bool writeStatusByte)
 {
     if (writeStatusByte)
     {
         Type type = midiEvent.GetType();
         byte number;
         StandardEventTypes.Channel.TryGetStatusByte(type, out number);
         FourBitNumber channel = ((ChannelEvent)midiEvent).Channel;
         byte          value   = DataTypesUtilities.Combine((FourBitNumber)number, channel);
         writer.WriteByte(value);
     }
     midiEvent.Write(writer, settings);
 }
        public void Write(MidiEvent midiEvent, MidiWriter writer, WritingSettings settings, bool writeStatusByte)
        {
            if (midiEvent == null)
            {
                throw new ArgumentNullException(nameof(midiEvent));
            }

            var channelEvent = midiEvent as ChannelEvent;

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

            //

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

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

                var channel = channelEvent.Channel;

                var totalStatusByte = DataTypesUtilities.Combine((FourBitNumber)statusByte, channel);
                writer.WriteByte(totalStatusByte);
            }

            //

            midiEvent.Write(writer, settings);
        }
示例#8
0
 internal override short ToInt16()
 {
     return((short)-DataTypesUtilities.Combine((byte)Format, Resolution));
 }
 // Token: 0x06003459 RID: 13401 RVA: 0x00018023 File Offset: 0x00016223
 internal override short ToInt16()
 {
     return(-DataTypesUtilities.Combine((byte)this.Format, this.Resolution));
 }