void InputDevice_MessageReceived(object sender, MidiMessage message, int channel, int key, int value) { ControlMap map = null; map = FindMap(channel, key); if (MessageReceived != null) { MessageReceived.Invoke(this, message, channel, key, value); } if (map == null) { if (UnhandledMessageReceived != null) { UnhandledMessageReceived.Invoke(this, message, channel, key, value); } } else { map.DispatchMessage(message, channel, key, value); if (map.AutoRepeat && map.KeyDown && !AutoRepeatList.Contains(map)) { AutoRepeatList.Add(map); } else if (map.AutoRepeat && !map.KeyDown && AutoRepeatList.Contains(map)) { AutoRepeatList.Remove(map); } } }
void button_Click(object sender, EventArgs e) { if (!editMode) { ControlMap map = (ControlMap)((WwtButton)sender).Tag; map.DispatchMessage(MIDI.MidiMessage.NoteOn, -1, 0, 127); } }
void button_ValueChanged(object sender, EventArgs e) { TrackButton tb = sender as TrackButton; if (!editMode) { ControlMap map = (ControlMap)((UserControl)sender).Tag; map.DispatchMessage(MIDI.MidiMessage.NoteOn, -1, 0, tb.Value); } }
void button_CheckedChanged(object sender, EventArgs e) { if (!ignoreEvent) { ignoreEvent = true; WWTCheckbox checkbox = sender as WWTCheckbox; if (!editMode) { ControlMap map = (ControlMap)((UserControl)sender).Tag; checkbox.Checked = map.DispatchMessage(MIDI.MidiMessage.NoteOn, -1, 0, 127); } ignoreEvent = false; } }