Exemplo n.º 1
0
        public void Send(byte [] mevent, int offset, int length, long timestamp)
        {
            if (mevent == null)
            {
                throw new ArgumentNullException("mevent");
            }
            if (mevent.Length == 0)
            {
                return;                 // do nothing
            }
            var events = PortMidiStream.Convert(mevent, 0, length);

            if (events.Any())
            {
                var first = events.First();
                first.Timestamp = (int)timestamp;
                impl.Write(first);
                foreach (var evt in events.Skip(1))
                {
                    impl.Write(evt);
                }
            }
        }
Exemplo n.º 2
0
 void SendMidiMessage(Midi.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
     {
         output.Write(0, new PortMidiMessage(m.StatusByte, m.Msb, m.Lsb));
     }
 }