1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use crate::note::Note;
pub type Ticks = u32;
pub type Byte = u8;
#[derive(Debug, Clone, Copy)]
pub enum KeyEventType {
Press,
Release,
Aftertouch,
}
#[derive(Debug, Clone)]
pub enum EventType {
Key {
typ: KeyEventType,
note: Note,
velocity: Byte,
},
ControlChange {
controller: Byte,
value: Byte,
},
PatchChange {
program: Byte,
},
ChannelAftertouch {
channel: Byte,
},
PitchWheelChange {
value: u16,
},
Meta {
typ: Byte,
data: Vec<u8>,
},
}
#[derive(Debug, Clone)]
pub struct Event {
pub delay: Ticks,
pub channel: Byte,
pub typ: EventType,
}