pub struct MidiSysExEvent { /* private fields */ }Expand description
A raw MIDI 1.0 System Exclusive (SysEx) event.
This event contains a pointer to a sysex data buffer. The lifetime of this
buffer is only guaranteed to be valid for the duration of the process call
(when received from the host) or the try_push call (when sent to the host).
Because of this, if you need to keep the data around for longer, you must copy it to a plugin-owned or host-owned buffer.
Implementations§
Source§impl MidiSysExEvent
impl MidiSysExEvent
Sourcepub const unsafe fn new(
time: u32,
port_index: u16,
data: &[u8],
) -> MidiSysExEvent
pub const unsafe fn new( time: u32, port_index: u16, data: &[u8], ) -> MidiSysExEvent
§Panics
This will panic if data.len() is larger than u32::MAX.
§Safety
Users must ensure that the buffer lives long enough.
As a plugin, the buffer must live at least until this event is try_pushed into the host’s
output event buffer for the last time.
As a host, the buffer must live at least until this event is used for the last time through
input buffers passed to a plugin method call (e.g. process or flush).
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) -> MidiSysExEvent
pub const fn with_port_index(self, port_index: u16) -> MidiSysExEvent
Sets the index of the port this event applies to.
Sourcepub const fn buffer_ptr(&self) -> *const u8
pub const fn buffer_ptr(&self) -> *const u8
A raw pointer to the sysex data buffer.
Sourcepub const fn buffer_size(&self) -> u32
pub const fn buffer_size(&self) -> u32
The size of the sysex data buffer.
Sourcepub const unsafe fn data<'a>(&self) -> &'a [u8] ⓘ
pub const unsafe fn data<'a>(&self) -> &'a [u8] ⓘ
§Safety
Users must ensure that the buffer lives long enough.
As a plugin, host-provided buffers are guaranteed to live at least as long as the current
method call (e.g. process or flush).
As a host, plugin-provided buffers are guaranteed to live at least as long as this event’s
call to OutputEventBuffer::try_push. Note that this means that accessing the data buffer
after the current plugin method call has returned is always disallowed.
Sourcepub const fn as_raw(&self) -> &clap_event_midi_sysex
pub const fn as_raw(&self) -> &clap_event_midi_sysex
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_midi_sysex
pub const unsafe fn as_raw_mut(&mut self) -> &mut clap_event_midi_sysex
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_midi_sysex) -> MidiSysExEvent
pub const fn from_raw(raw: &clap_event_midi_sysex) -> MidiSysExEvent
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_midi_sysex) -> &MidiSysExEvent
pub const fn from_raw_ref(raw: &clap_event_midi_sysex) -> &MidiSysExEvent
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_midi_sysex,
) -> &mut MidiSysExEvent
pub const fn from_raw_mut( raw: &mut clap_event_midi_sysex, ) -> &mut MidiSysExEvent
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 MidiSysExEvent
impl AsRef<UnknownEvent> for MidiSysExEvent
Source§fn as_ref(&self) -> &UnknownEvent
fn as_ref(&self) -> &UnknownEvent
Source§impl Clone for MidiSysExEvent
impl Clone for MidiSysExEvent
Source§fn clone(&self) -> MidiSysExEvent
fn clone(&self) -> MidiSysExEvent
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 MidiSysExEvent
Source§impl Debug for MidiSysExEvent
impl Debug for MidiSysExEvent
impl Eq for MidiSysExEvent
Source§impl Event for MidiSysExEvent
impl Event for MidiSysExEvent
Source§const TYPE_ID: u16 = CLAP_EVENT_MIDI_SYSEX
const TYPE_ID: u16 = CLAP_EVENT_MIDI_SYSEX
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.