コード例 #1
0
        public void CreateNormalSysEx_Completed()
        {
            var data       = new byte[] { 0x67, 0x45, 0xF7 };
            var sysExEvent = new NormalSysExEvent(data);

            CollectionAssert.AreEqual(data, sysExEvent.Data, "Data is invalid.");
            Assert.IsTrue(sysExEvent.Completed, "'Completed' value is invalid.");
        }
コード例 #2
0
        /// <summary>
        /// Determines whether the specified event is equal to the current one.
        /// </summary>
        /// <param name="normalSysExEvent">The event to compare with the current one.</param>
        /// <param name="respectDeltaTime">If true the <see cref="MidiEvent.DeltaTime"/> will be taken into an account
        /// while comparing events; if false - delta-times will be ignored.</param>
        /// <returns>true if the specified event is equal to the current one; otherwise, false.</returns>
        public bool Equals(NormalSysExEvent normalSysExEvent, bool respectDeltaTime)
        {
            if (ReferenceEquals(null, normalSysExEvent))
            {
                return(false);
            }

            if (ReferenceEquals(this, normalSysExEvent))
            {
                return(true);
            }

            return(base.Equals(normalSysExEvent, respectDeltaTime));
        }
コード例 #3
0
        private void OnSysExEventSent(IntPtr sysExHeaderPointer)
        {
            byte[] data = null;

            try
            {
                data = MidiWinApi.UnpackSysExBytes(sysExHeaderPointer);
                var midiEvent = new NormalSysExEvent(data);
                OnEventSent(midiEvent);

                UnprepareSysExBuffer(sysExHeaderPointer);
                _sysExHeadersPointers.Remove(sysExHeaderPointer);
            }
            catch (Exception ex)
            {
                var exception = new MidiDeviceException("Failed to parse sent system exclusive event.", ex);
                exception.Data.Add("Data", data);
                OnError(exception);
            }
        }
コード例 #4
0
        private void OnSysExMessage(IntPtr sysExHeaderPointer)
        {
            byte[] data = null;

            try
            {
                data = MidiWinApi.UnpackSysExBytes(sysExHeaderPointer);
                var midiEvent = new NormalSysExEvent(data);
                OnEventReceived(midiEvent);

                UnprepareSysExBuffer(sysExHeaderPointer);
                PrepareSysExBuffer();
            }
            catch (Exception ex)
            {
                var exception = new MidiDeviceException($"Failed to parse system exclusive message.", ex);
                exception.Data.Add("Data", data);
                OnError(exception);
            }
        }
コード例 #5
0
 /// <summary>
 /// Determines whether the specified event is equal to the current one.
 /// </summary>
 /// <param name="normalSysExEvent">The event to compare with the current one.</param>
 /// <returns>true if the specified event is equal to the current one; otherwise, false.</returns>
 public bool Equals(NormalSysExEvent normalSysExEvent)
 {
     return(Equals(normalSysExEvent, true));
 }