Beispiel #1
0
 private static byte[] BuildByteMessage(int intMessage)
 {
     unchecked
     {
         return(new byte[] { (byte)ShortMessage.UnpackStatus(intMessage),
                             (byte)ShortMessage.UnpackData1(intMessage),
                             (byte)ShortMessage.UnpackData2(intMessage) });
     }
 }
        public MidiEvent(int absoluteTicks, IMidiMessage message)
        {
            MessageType = message.MessageType;
            MessageData = Int32.MinValue;
            byteData    = null;

            this.AbsoluteTicks = absoluteTicks;

            Deleted = false;

            Data2    = Data1 = Int32.MinValue;
            MetaType = Midi.MetaType.Unknown;
            Command  = ChannelCommand.Invalid;

            if (MessageType == Midi.MessageType.Channel)
            {
                SetChanMessageData((message as ChannelMessage).Message);
            }
            else if (MessageType == Midi.MessageType.Meta)
            {
                var msg = (message as MetaMessage);
                this.byteData = msg.GetBytes();
                this.MetaType = msg.MetaType;
                Text          = msg.Text ?? "";
            }
            else if (MessageType == Midi.MessageType.SystemRealtime)
            {
                this.realtimeType = (message as SysRealtimeMessage).SysRealtimeType;
                Text = GetText();
            }
            else if (MessageType == Midi.MessageType.SystemExclusive)
            {
                var sysEx = message as Midi.SysExMessage;

                this.MessageData = sysEx.Status;

                byteData = message.GetBytes();
                Text     = GetText();
            }
            else
            {
                MessageData = (message as ShortMessage).Message;
                Data1       = ShortMessage.UnpackData1(MessageData);
                Data2       = ShortMessage.UnpackData2(MessageData);
                byteData    = message.GetBytes();
                Text        = GetText();
            }
        }
 public RawMessageEventArgs(int message)
 {
     this.message = new byte[] { (byte)ShortMessage.UnpackStatus(message),
                                 (byte)ShortMessage.UnpackData1(message),
                                 (byte)ShortMessage.UnpackData2(message) };
 }