pub enum EventBody {
Show 23 variants
NoteOn {
group: u8,
channel: u8,
note: u8,
velocity: u8,
},
NoteOff {
group: u8,
channel: u8,
note: u8,
velocity: u8,
},
Aftertouch {
group: u8,
channel: u8,
note: u8,
pressure: u8,
},
ChannelPressure {
group: u8,
channel: u8,
pressure: u8,
},
ControlChange {
group: u8,
channel: u8,
cc: u8,
value: u8,
},
PitchBend {
group: u8,
channel: u8,
value: u16,
},
ProgramChange {
group: u8,
channel: u8,
program: u8,
},
NoteOn2 {
group: u8,
channel: u8,
note: u8,
velocity: u16,
attribute_type: u8,
attribute: u16,
},
NoteOff2 {
group: u8,
channel: u8,
note: u8,
velocity: u16,
attribute_type: u8,
attribute: u16,
},
PolyPressure2 {
group: u8,
channel: u8,
note: u8,
pressure: u32,
},
PerNoteCC {
group: u8,
channel: u8,
note: u8,
cc: u8,
value: u32,
registered: bool,
},
PerNotePitchBend {
group: u8,
channel: u8,
note: u8,
value: u32,
},
PerNoteManagement {
group: u8,
channel: u8,
note: u8,
flags: u8,
},
ControlChange2 {
group: u8,
channel: u8,
cc: u8,
value: u32,
},
ChannelPressure2 {
group: u8,
channel: u8,
pressure: u32,
},
PitchBend2 {
group: u8,
channel: u8,
value: u32,
},
ProgramChange2 {
group: u8,
channel: u8,
program: u8,
bank: Option<(u8, u8)>,
},
RegisteredController {
group: u8,
channel: u8,
bank: u8,
index: u8,
value: u32,
},
AssignableController {
group: u8,
channel: u8,
bank: u8,
index: u8,
value: u32,
},
ParamChange {
id: u32,
value: f64,
},
ParamMod {
id: u32,
note_id: i32,
value: f64,
},
Transport(TransportInfo),
SysEx {
pool_offset: u32,
len: u32,
},
}Variants§
NoteOn
Note on. MIDI 1.0 quirk: a NoteOn with velocity == 0 is
a NoteOff. Format wrappers normalize that at parse time so
plugin code can match NoteOn without checking velocity.
NoteOff
Aftertouch
Polyphonic key pressure (per-note aftertouch).
ChannelPressure
ControlChange
PitchBend
14-bit pitch bend, raw code 0..=16383. 8192 is center.
See truce_utils::midi::norm_pitch_bend for the
asymmetric-range conversion helper.
ProgramChange
NoteOn2
MIDI 2.0 NoteOn. velocity is 0..=65535; unlike MIDI 1.0,
a zero velocity is a genuine zero (NoteOff is its own
dedicated message). attribute_type indicates how
attribute should be interpreted: 0 = no attribute, 1 =
manufacturer-specific, 2 = profile-specific, 3 = Pitch 7.9.
NoteOff2
PolyPressure2
MIDI 2.0 polyphonic key pressure (pressure: u32).
PerNoteCC
MIDI 2.0 per-note controller. registered = true for
Registered Per-Note (RPN-like indexed list); false for
Assignable Per-Note (free-form per-controller mapping).
PerNotePitchBend
MIDI 2.0 per-note pitch bend (value: u32). 0x8000_0000
is center.
PerNoteManagement
MIDI 2.0 per-note management flags. Bit 0 = detach per-note controllers from active note; bit 1 = reset (set) per-note controllers to default values.
ControlChange2
MIDI 2.0 channel-wide control change (32-bit).
ChannelPressure2
MIDI 2.0 channel pressure (32-bit aftertouch on the whole channel).
PitchBend2
MIDI 2.0 channel pitch bend (32-bit). 0x8000_0000 is
center.
ProgramChange2
MIDI 2.0 program change. Optional bank pair (MSB, LSB);
MIDI 2.0’s “B” flag is encoded as Some / None. When
None, the host hasn’t selected a bank and the program
applies in the current bank.
RegisteredController
MIDI 2.0 Registered Controller (the spec’s RPN replacement,
32-bit). bank and index are the two 7-bit identifiers
the spec reserves for Registered Parameter Numbers.
AssignableController
MIDI 2.0 Assignable Controller (the spec’s NRPN
replacement, 32-bit). bank and index are
manufacturer-defined.
ParamChange
ParamMod
Parameter modulation offset (CLAP-specific, zero on other
formats). Effective value is base + value. The base value
is unchanged.
Transport(TransportInfo)
SysEx
System Exclusive (SysEx) message - MIDI 1.0 and MIDI 2.0
alike. The payload bytes live in EventList::sysex_bytes;
resolve a body to its slice with
event_list.sysex_bytes(&body) rather than indexing the
pool directly. The bytes are the inner SysEx data
without the leading 0xF0 start byte or trailing 0xF7
end byte - format wrappers strip those at the boundary so
plugin code doesn’t have to.
Inlining the bytes in the variant would balloon every event’s
footprint to the worst-case (~64 KiB) - channel-voice events
are <8 bytes today and we want to keep the per-event memory
pressure on the audio thread proportional to that. The
indices-into-a-pool layout pays the price (two-step access)
for the SysEx-handling path only.