gled_protocol/midi.rs
1//! MIDI tools of the interface that run in the engine: the monitor of
2//! incoming traffic and the test outputs for configuring controllers.
3
4use serde::{Deserialize, Serialize};
5
6/// Something that happened on a MIDI port.
7#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
8pub struct MidiMonitorEvent {
9 pub timestamp_ms: u128,
10 pub port_name: String,
11 pub label: String,
12 pub bytes: Vec<u8>,
13}
14
15/// Test output for MIDI controllers, from the interface to the MIDI runtime.
16#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
17pub enum TestCommand {
18 /// Send a MIDI test output: (status, data1, value)
19 SendOutput { status: u8, data1: u8, value: u8 },
20 /// Clear a MIDI test output by (status, data1)
21 ClearOutput { status: u8, data1: u8 },
22 /// Set the test device port name
23 SetTestDevice { port_name: String },
24 /// Unset test device (stop all test sending)
25 UnsetTestDevice,
26 /// Forget every controller's test state.
27 ClearAllTestStates,
28}