Ejemplo n.º 1
0
        private void MIDIMessageReceived(object sender, MidiInMessageEventArgs e)
        {
            if (e.MidiEvent is NoteEvent)
            {
                this.Note = new NoteID(((NoteEvent)e.MidiEvent).NoteNumber+1);

                SetTextCallback d = new SetTextCallback(SetPitchBoxText);
                this.Invoke(d, new object[] { ((NoteEvent)e.MidiEvent).NoteName });
            }
        }
Ejemplo n.º 2
0
        private void MIDICallback(object sender, MidiInMessageEventArgs e)
        {
            if (this != Form.ActiveForm) return;

            if (e.MidiEvent is NoteEvent)
            {
                NoteEvent noteEvent = (NoteEvent)e.MidiEvent;
                NoteID id = new NoteID(noteEvent.NoteNumber + 1);

                Sound s = ShortcutManager<NoteID>.GetInstance(NoteID.Comparer).GetSound(id);

                if (s != null)
                {
                    if (noteEvent.Velocity != 0) // KeyDown and not KeyUp
                    {
                        if (NetworkConnection.GetInstance().Connected)
                        {
                            NetworkConnection.GetInstance().PlayOnServer(s.ID);
                        }
                        else
                        {
                            Model.Model.GetInstance().PlaySound(s);
                        }
                    }
                }
            }
        }