Example #1
0
        static void FilterNote(MidiEvent e)
        {
            var shouldSend = true;


            if (e is NoteEvent && ((NoteEvent)e).CommandCode == MidiCommandCode.NoteOn)
            {
                shouldSend = Scale.IsInScale(scaleProgression, ((NoteEvent)e).NoteName);
                Program.mainForm.OnNotePressed(((NoteEvent)e).NoteName);
            }

            if (e is NoteEvent && ((NoteEvent)e).CommandCode == MidiCommandCode.NoteOff)
            {
                Program.mainForm.OnNoteReleased(((NoteEvent)e).NoteName);
            }

            if (shouldSend)
            {
                midiOut.Send(e.GetAsShortMessage());
            }
            else
            {
                Console.WriteLine(String.Format("Event {0} was filtered out.", e));
            }
        }
Example #2
0
        private void SendNextMidiOutMessage()
        {
            if (midiOut == null)
            {
                midiOut = new MidiOut(comboBoxMidiOutDevices.SelectedIndex);
            }
            MidiEvent eventToSend = events[midiOutIndex++];

            midiOut.Send(eventToSend.GetAsShortMessage());
            progressLog1.LogMessage(Color.Green, String.Format("Sent {0}", eventToSend));
            if (midiOutIndex >= events.Count)
            {
                midiOutIndex = 0;
            }
        }
 /// <summary>
 ///     Sends MIDI event to connected device.
 /// </summary>
 /// <param name="e">MIDI event.</param>
 public void SendEvent(MidiEvent e)
 {
     e.Channel = Channel;
     _connection?.Send(e.GetAsShortMessage());
 }
 private void SendMidiOutMessage(MidiEvent eventToSend)
 {
     midiOut.Send(eventToSend.GetAsShortMessage());
     progressLog1.LogMessage(Color.Green, String.Format("Sent {0}", eventToSend));
 }