#[repr(C)]pub struct Event {
pub event_type: EventType,
pub byte_size: i32,
pub delta_frames: i32,
pub _flags: i32,
pub _reserved: [u8; 16],
}
Expand description
A VST event intended to be casted to a corresponding type.
The event types are not all guaranteed to be the same size,
so casting between them can be done
via mem::transmute()
while leveraging pointers, e.g.
// let event: *const Event = ...;
let midi_event: &MidiEvent = unsafe { std::mem::transmute(event) };
Fields§
§event_type: EventType
The type of event. This lets you know which event this object should be casted to.
Example
// let mut event: *mut Event = ...
match unsafe { (*event).event_type } {
EventType::Midi => {
let midi_event: &MidiEvent = unsafe {
std::mem::transmute(event)
};
// ...
}
EventType::SysEx => {
let sys_event: &SysExEvent = unsafe {
std::mem::transmute(event)
};
// ...
}
// ...
}
byte_size: i32
Size of this structure; mem::sizeof::<Event>()
.
delta_frames: i32
Number of samples into the current processing block that this event occurs on.
E.g. if the block size is 512 and this value is 123, the event will occur on sample
samples[123]
.
_flags: i32
Generic flags, none defined in VST api yet.
_reserved: [u8; 16]
The Event
type is cast appropriately, so this acts as reserved space.
The actual size of the data may vary as this type is not guaranteed to be the same size as the other event types.