コード例 #1
0
        public void PrintText(string text, int line)
        {
            //_midiDevice.SendSysEx(new byte[6] { 0xF0, 0x7E, 0x7F, 0x06, 0x01, 0xF7 }); // Screen init
            var splitText  = ChunksUpto(text, 8);
            var enumerable = splitText as string[] ?? splitText.ToArray();
            var pos        = 1;

            for (int i = 0; i < enumerable.ToList().Count; i++)
            {
                var chunk   = enumerable.ToList()[i];
                var message = new byte[15];
                message[0] = 0xF0;
                message[1] = 0x13;
                message[2] = 0x01;
                message[3] = 0x40;
                if (i == 8)
                {
                    pos = 10;
                }
                message[4] = Convert.ToByte(pos); // position
                //message[4] = 0x16; // position
                message[5] = 0x7F;
                message[6] = 0x00;
                Console.WriteLine("Pos:: " + byteArrayToString(new[] { Convert.ToByte(i) }));
                for (var index = 1; index < chunk.Length + 1; index++)
                {
                    char letter = chunk[index - 1];
                    byte b      = Convert.ToByte(letter);
                    message[index + 6] = b;
                }

                message[14] = 0xF7;
                ++pos;
                Console.WriteLine(byteArrayToString(message));
                _midiDevice.SendSysEx(message);
                //_midiDevice.SendSysEx(new byte[15] { 0xF0, 0x13, 0x01, 0x40, 0x10, 0x7F, 0x01, 0x4F, 0x70, 0x65, 0x6E, 0x20, 0x6F, 0x72, 0xF7 });
                Thread.Sleep(200);
            }
        }