예제 #1
0
        public static SysExMessage SendWithResult(this IMidiDevice ifc, SysExMessage msg, TimeSpan timeout)
        {
            ifc.SendSysExMessage(msg);
            ifc.WaitForSysExMessage(timeout);
            var result = ifc.ReadSysExMessage();

            return(result);
        }
예제 #2
0
        protected override void Parse(byte[] data)
        {
            var ls  = new List <object>();
            var eos = false;

            using (var ms = new MemoryStream(data))
            {
                while (!eos)
                {
                    try
                    {
                        var mOffset = ReadVarLength(ms);
                        var mEvent  = ReadEvent(ms);
                        ls.Add(SysExMessage.Parse(mEvent));
                    }
                    catch (NotSupportedException)
                    {
                    }
                    eos = ms.Position == ms.Length;
                }
            }

            Messages = ls.OfType <SysExMessage>().ToArray();
        }