Ejemplo n.º 1
0
        private void HandleNoOp(object state)
        {
            IntPtr     headerPtr = (IntPtr)state;
            MidiHeader header    = (MidiHeader)Marshal.PtrToStructure(headerPtr, typeof(MidiHeader));

            byte[] midiEvent = new byte[SizeOfMidiEvent];

            for (int i = 0; i < midiEvent.Length; i++)
            {
                midiEvent[i] = Marshal.ReadByte(header.data, header.offset + i);
            }

            // If this is a NoOp event.
            if ((midiEvent[EventTypeIndex] & MEVT_NOP) == MEVT_NOP)
            {
                // Clear the event type byte.
                midiEvent[EventTypeIndex] = 0;

                NoOpEventArgs e = new NoOpEventArgs(BitConverter.ToInt32(midiEvent, EventCodeOffset));

                context.Post(new SendOrPostCallback(delegate(object s)
                {
                    OnNoOpOccurred(e);
                }), null);
            }
        }
Ejemplo n.º 2
0
        private void OnNoOpOccurred(NoOpEventArgs e)
        {
            EventHandler <NoOpEventArgs> handler = NoOpOccurred;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Ejemplo n.º 3
0
        private void HandleNoOp(object state)
        {
            IntPtr headerPtr = (IntPtr)state;
            MidiHeader header = (MidiHeader)Marshal.PtrToStructure(headerPtr, typeof(MidiHeader));

            byte[] midiEvent = new byte[SizeOfMidiEvent];

            for(int i = 0; i < midiEvent.Length; i++)
            {
                midiEvent[i] = Marshal.ReadByte(header.data, header.offset + i);
            }

            // If this is a NoOp event.
            if((midiEvent[EventTypeIndex] & MEVT_NOP) == MEVT_NOP)
            {
                // Clear the event type byte.
                midiEvent[EventTypeIndex] = 0;

                NoOpEventArgs e = new NoOpEventArgs(BitConverter.ToInt32(midiEvent, EventCodeOffset));

                context.Post(new SendOrPostCallback(delegate(object s)
                {
                    OnNoOpOccurred(e);
                }), null);
            }
        }
Ejemplo n.º 4
0
        private void OnNoOpOccurred(NoOpEventArgs e)
        {
            EventHandler<NoOpEventArgs> handler = NoOpOccurred;

            if(handler != null)
            {
                handler(this, e);
            }
        }
Ejemplo n.º 5
0
 private void OnNoOpOccurred(NoOpEventArgs e)
 {
     NoOpOccurred?.Invoke(this, e);
 }