Struct vst2::api::Event [] [src]

#[repr(C)]
pub struct Event { pub event_type: EventType, pub byte_size: i32, pub delta_frames: i32, pub _flags: i32, pub _reserved: [u8; 16], }

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

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)
        };

        // ...
    }
    // ...
}

Size of this structure; mem::sizeof::<Event>().

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

Generic flags, none defined in VST api yet.

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.

Trait Implementations

impl Copy for Event
[src]

impl Clone for Event
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more