Skip to main content

EventBody

Enum EventBody 

Source
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.

Fields

§group: u8
§channel: u8
§note: u8
§velocity: u8
§

NoteOff

Fields

§group: u8
§channel: u8
§note: u8
§velocity: u8
§

Aftertouch

Polyphonic key pressure (per-note aftertouch).

Fields

§group: u8
§channel: u8
§note: u8
§pressure: u8
§

ChannelPressure

Fields

§group: u8
§channel: u8
§pressure: u8
§

ControlChange

Fields

§group: u8
§channel: u8
§cc: u8
§value: u8
§

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.

Fields

§group: u8
§channel: u8
§value: u16
§

ProgramChange

Fields

§group: u8
§channel: u8
§program: u8
§

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.

Fields

§group: u8
§channel: u8
§note: u8
§velocity: u16
§attribute_type: u8
§attribute: u16
§

NoteOff2

Fields

§group: u8
§channel: u8
§note: u8
§velocity: u16
§attribute_type: u8
§attribute: u16
§

PolyPressure2

MIDI 2.0 polyphonic key pressure (pressure: u32).

Fields

§group: u8
§channel: u8
§note: u8
§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).

Fields

§group: u8
§channel: u8
§note: u8
§cc: u8
§value: u32
§registered: bool
§

PerNotePitchBend

MIDI 2.0 per-note pitch bend (value: u32). 0x8000_0000 is center.

Fields

§group: u8
§channel: u8
§note: u8
§value: u32
§

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.

Fields

§group: u8
§channel: u8
§note: u8
§flags: u8
§

ControlChange2

MIDI 2.0 channel-wide control change (32-bit).

Fields

§group: u8
§channel: u8
§cc: u8
§value: u32
§

ChannelPressure2

MIDI 2.0 channel pressure (32-bit aftertouch on the whole channel).

Fields

§group: u8
§channel: u8
§pressure: u32
§

PitchBend2

MIDI 2.0 channel pitch bend (32-bit). 0x8000_0000 is center.

Fields

§group: u8
§channel: u8
§value: u32
§

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.

Fields

§group: u8
§channel: u8
§program: u8
§bank: Option<(u8, u8)>
§

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.

Fields

§group: u8
§channel: u8
§bank: u8
§index: u8
§value: u32
§

AssignableController

MIDI 2.0 Assignable Controller (the spec’s NRPN replacement, 32-bit). bank and index are manufacturer-defined.

Fields

§group: u8
§channel: u8
§bank: u8
§index: u8
§value: u32
§

ParamChange

Fields

§id: u32
§value: f64
§

ParamMod

Parameter modulation offset (CLAP-specific, zero on other formats). Effective value is base + value. The base value is unchanged.

Fields

§id: u32
§note_id: i32
§value: f64
§

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.

Fields

§pool_offset: u32
§len: u32

Trait Implementations§

Source§

impl Clone for EventBody

Source§

fn clone(&self) -> EventBody

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EventBody

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for EventBody

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.