SendMessage() public method

public SendMessage ( byte message, int length ) : void
message byte
length int
return void
Example #1
0
        void SendMidiEvent(MidiEvent m)
        {
            if ((m.Value & 0xFF) == 0xF0)
            {
                WriteSysEx(0xF0, m.Data);
            }
            else if ((m.Value & 0xFF) == 0xF7)
            {
                WriteSysEx(0xF7, m.Data);
            }
            else if ((m.Value & 0xFF) == 0xFF)
            {
                return;                 // meta. Nothing to send.
            }
            else
            {
                switch (m.StatusByte & 0xF0)
                {
                case MidiEvent.Program:
                case MidiEvent.CAf:
                    buf2 [0] = m.StatusByte;
                    buf2 [1] = m.Msb;
                    output.SendMessage(buf2, buf2.Length);
                    break;

                default:
                    buf3 [0] = m.StatusByte;
                    buf3 [1] = m.Msb;
                    buf3 [2] = m.Lsb;
                    output.SendMessage(buf3, buf3.Length);
                    break;
                }
            }
        }
Example #2
0
 public void Send(byte [] mevent, int offset, int length, long timestamp)
 {
     if (timestamp > 0)
     {
         throw new InvalidOperationException("non-zero timestamp is not supported");
     }
     if (mevent == null)
     {
         throw new ArgumentNullException("mevent");
     }
     if (mevent.Length == 0)
     {
         return;                 // do nothing
     }
     impl.SendMessage(mevent, length);
 }