#[repr(C)]pub struct MIDIEventList {
pub protocol: MIDIProtocolID,
pub numPackets: u32,
pub packet: [MIDIEventPacket; 1],
}MIDIServices only.Expand description
A variable-length list of MIDIEventPackets.
The timestamps in the list must be in ascending order.
Note that the packets in the list, while defined as an array, may not be accessed as an array, since they are variable-length. To iterate through the packets in an event list, use a loop such as:
MIDIEventPacket *packet =
&packetList
->packet[0];
for (unsigned i = 0; i
<
packetList->numPackets; ++i) {
...
packet = MIDIEventPacketNext(packet);
}WARNING: When using MIDIEventList in C++ be aware of the following:
MIDIEventList is a variable-length struct and should ALWAYS be passed-by-pointer rather than passed-by-reference. Conversion from a MIDIEventList reference to a pointer is undefined behavior and can lead to the unintended truncation of data.
Field: protocol The MIDI protocol variant of the events in the list. Field: numPackets The number of MIDIEventPacket structs in the list. Field: packet An open-ended array of variable-length MIDIEventPacket structs.
See also Apple’s documentation
Fields§
§protocol: MIDIProtocolID§numPackets: u32§packet: [MIDIEventPacket; 1]Implementations§
Source§impl MIDIEventList
impl MIDIEventList
Sourcepub unsafe fn for_each_event(
evtlist: *const MIDIEventList,
visitor: MIDIEventVisitor,
visitor_context: *mut c_void,
)
Available on crate feature MIDIMessages only.
pub unsafe fn for_each_event( evtlist: *const MIDIEventList, visitor: MIDIEventVisitor, visitor_context: *mut c_void, )
MIDIMessages only.Parses UMPs from a MIDIEventList.
MIDIEventListForEachEvent iterates over all UMPs in the provided MIDIEventList. It parses each UMP and fills a MIDIUniversalMessage struct. It calls the provided visitor on each of these UMPs. In case of an unknown UMP the raw UMP words will be provided.
Parameter evtlist: The MIDIEventList which is to be parsed.
Parameter visitor: The visitor that is called on each UMP in evtlist.
Parameter visitorContext: A context for the visitor that is passed to it when being called.
§Safety
evtlistmust be a valid pointer.visitormust be implemented correctly.visitor_contextmust be a valid pointer.
Source§impl MIDIEventList
impl MIDIEventList
Sourcepub unsafe fn init(
evtlist: NonNull<MIDIEventList>,
protocol: MIDIProtocolID,
) -> NonNull<MIDIEventPacket>
pub unsafe fn init( evtlist: NonNull<MIDIEventList>, protocol: MIDIProtocolID, ) -> NonNull<MIDIEventPacket>
Prepares a MIDIEventList to be built up dynamically.
Parameter evtlist: The event list to be initialized.
Returns: A pointer to the first MIDIEventPacket in the event list.
§Safety
evtlist must be a valid pointer.
Sourcepub unsafe fn add(
evtlist: NonNull<MIDIEventList>,
list_size: c_ulong,
cur_packet: NonNull<MIDIEventPacket>,
time: MIDITimeStamp,
word_count: c_ulong,
words: NonNull<u32>,
) -> NonNull<MIDIEventPacket>
pub unsafe fn add( evtlist: NonNull<MIDIEventList>, list_size: c_ulong, cur_packet: NonNull<MIDIEventPacket>, time: MIDITimeStamp, word_count: c_ulong, words: NonNull<u32>, ) -> NonNull<MIDIEventPacket>
Adds a MIDI event to a MIDIEventList.
Parameter evtlist: The event list to which the event is to be added.
Parameter listSize: The capacity, in bytes, of the event list.
Parameter curPacket: A packet pointer returned by a previous call to
MIDIEventListInit or MIDIEventListAdd for this packet
list.
Parameter time: The new event’s time.
Parameter wordCount: The number of valid MIDI 32-bit words which follow, in data.
Parameter words: The new event. May be a single MIDI event, or a partial
sys-ex event. Running status is
not
permitted.
Returns: Returns null if there was not room in the packet for the event; otherwise returns a packet pointer which should be passed as curPacket in a subsequent call to this function.
The maximum size of a event list is 65536 bytes. Large sysex messages must be sent in smaller event lists.
Note that events must use the same protocol as was passed to MIDIEventListInit().
§Safety
evtlistmust be a valid pointer.cur_packetmust be a valid pointer.wordsmust be a valid pointer.
Trait Implementations§
Source§impl Clone for MIDIEventList
impl Clone for MIDIEventList
Source§fn clone(&self) -> MIDIEventList
fn clone(&self) -> MIDIEventList
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MIDIEventList
impl Debug for MIDIEventList
Source§impl Encode for MIDIEventList
Available on crate feature objc2 only.
impl Encode for MIDIEventList
objc2 only.Source§impl PartialEq for MIDIEventList
impl PartialEq for MIDIEventList
Source§impl RefEncode for MIDIEventList
Available on crate feature objc2 only.
impl RefEncode for MIDIEventList
objc2 only.