Skip to content

Commit a830ce6

Browse files
committed
Add MIDIEvent.source
1 parent 49b7993 commit a830ce6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lighthouse-protocol/src/input/input_event.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
22

33
use crate::Direction;
44

5-
use super::{EventSource, GamepadEvent, KeyEvent, MouseEvent, UnknownEvent};
5+
use super::{EventSource, GamepadEvent, KeyEvent, MIDIEvent, MouseEvent, UnknownEvent};
66

77
/// A user input event, as generated by the new frontend (LUNA).
88
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
@@ -11,6 +11,7 @@ pub enum InputEvent {
1111
Key(KeyEvent),
1212
Mouse(MouseEvent),
1313
Gamepad(GamepadEvent),
14+
MIDI(MIDIEvent),
1415
#[serde(untagged)]
1516
Unknown(UnknownEvent),
1617
}
@@ -22,6 +23,7 @@ impl InputEvent {
2223
InputEvent::Key(KeyEvent { source, .. }) => source,
2324
InputEvent::Mouse(MouseEvent { source, .. }) => source,
2425
InputEvent::Gamepad(GamepadEvent { source, .. }) => source,
26+
InputEvent::MIDI(MIDIEvent { source, .. }) => source,
2527
InputEvent::Unknown(UnknownEvent { source, .. }) => source,
2628
}
2729
}

lighthouse-protocol/src/input/midi_event.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
use serde::{Deserialize, Serialize};
22

3+
use super::EventSource;
4+
35
/// A MIDI message event.
46
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
57
pub struct MIDIEvent {
8+
/// The client identifier. Also unique per MIDI input device.
9+
pub source: EventSource,
610
/// The binary MIDI message.
711
///
812
/// The first byte is a status byte (first/most significant bit = 1), the

0 commit comments

Comments
 (0)