pub struct Midi2Event { /* private fields */ }Expand description
A raw MIDI 2.0 event.
While it is possible to use a series of MIDI 2.0 events to send sysex data,
it is recommended to use the MidiSysExEvent type instead for efficiency.
Implementations§
Source§impl Midi2Event
impl Midi2Event
Sourcepub const fn new(time: u32, port_index: u16, data: [u32; 4]) -> Midi2Event
pub const fn new(time: u32, port_index: u16, data: [u32; 4]) -> Midi2Event
Creates a new raw MIDI 2.0 event from a time stamp, a port_index, and raw MIDI data.
Sourcepub const fn with_data(self, data: [u32; 4]) -> Midi2Event
pub const fn with_data(self, data: [u32; 4]) -> Midi2Event
Sets the raw MIDI 2.0 data, as 4 u32s.
Sourcepub const fn port_index(&self) -> u16
pub const fn port_index(&self) -> u16
The index of the port this event applies to.
Sourcepub const fn set_port_index(&mut self, port_index: u16)
pub const fn set_port_index(&mut self, port_index: u16)
Sets the index of the port this event applies to.
Sourcepub const fn with_port_index(self, port_index: u16) -> Midi2Event
pub const fn with_port_index(self, port_index: u16) -> Midi2Event
Sets the index of the port this event applies to.
Sourcepub const fn as_raw(&self) -> &clap_event_midi2
pub const fn as_raw(&self) -> &clap_event_midi2
Returns a shared reference to the underlying raw, C-FFI compatible event struct.
Sourcepub const unsafe fn as_raw_mut(&mut self) -> &mut clap_event_midi2
pub const unsafe fn as_raw_mut(&mut self) -> &mut clap_event_midi2
Returns an exclusive, mutable reference to the raw, C-FFI compatible event struct.
§Safety
This method allows mutating the event header’s fields, most notably type_, size and
space_id.
Modifying those fields may trigger Undefined Behavior, as it can make other readers of this event treat it as a type or size that it is actually not.
Sourcepub const fn from_raw(raw: &clap_event_midi2) -> Midi2Event
pub const fn from_raw(raw: &clap_event_midi2) -> Midi2Event
Creates a new event of this type from a reference to a raw, C-FFI compatible event struct.
§Panics
This method will panic if the given event struct’s header doesn’t actually match the expected event type.
Sourcepub const fn from_raw_ref(raw: &clap_event_midi2) -> &Midi2Event
pub const fn from_raw_ref(raw: &clap_event_midi2) -> &Midi2Event
Creates a reference to an event of this type from a reference to a raw, C-FFI compatible event struct.
§Panics
This method will panic if the given event struct’s header doesn’t actually match the expected event type.
Sourcepub const fn from_raw_mut(raw: &mut clap_event_midi2) -> &mut Midi2Event
pub const fn from_raw_mut(raw: &mut clap_event_midi2) -> &mut Midi2Event
Creates a mutable reference to a note event of this type from a reference to a raw, C-FFI compatible event struct.
§Panics
This method will panic if the given event struct’s header doesn’t actually match the expected note event type.
Trait Implementations§
Source§impl AsRef<UnknownEvent> for Midi2Event
impl AsRef<UnknownEvent> for Midi2Event
Source§fn as_ref(&self) -> &UnknownEvent
fn as_ref(&self) -> &UnknownEvent
Source§impl Clone for Midi2Event
impl Clone for Midi2Event
Source§fn clone(&self) -> Midi2Event
fn clone(&self) -> Midi2Event
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Midi2Event
Source§impl Debug for Midi2Event
impl Debug for Midi2Event
impl Eq for Midi2Event
Source§impl Event for Midi2Event
impl Event for Midi2Event
Source§const TYPE_ID: u16 = CLAP_EVENT_MIDI2
const TYPE_ID: u16 = CLAP_EVENT_MIDI2
Source§type EventSpace<'a> = CoreEventSpace<'a>
type EventSpace<'a> = CoreEventSpace<'a>
Source§fn flags(&self) -> EventFlags
fn flags(&self) -> EventFlags
EventFlags of this event.Source§fn set_flags(&mut self, flags: EventFlags)
fn set_flags(&mut self, flags: EventFlags)
EventFlags of this event.Source§fn with_flags(self, flags: EventFlags) -> Self
fn with_flags(self, flags: EventFlags) -> Self
EventFlags, and returns it. Read moreSource§fn with_time(self, time: u32) -> Self
fn with_time(self, time: u32) -> Self
Source§fn header(&self) -> &EventHeader<Self>
fn header(&self) -> &EventHeader<Self>
Source§fn header_mut(&mut self) -> &mut EventHeader<Self>
fn header_mut(&mut self) -> &mut EventHeader<Self>
Source§fn as_unknown(&self) -> &UnknownEvent
fn as_unknown(&self) -> &UnknownEvent
UnknownEvent.