pub fn new(capacity: usize) -> Self {
        unsafe {
            let events_ptr = MidiVSTConverter::allocate_events(capacity);
            let event_ptrs = std::slice::from_raw_parts_mut(
                &mut (*events_ptr).events[0] as *mut *mut _ as *mut *mut _,
                capacity,
            );
            let mut events_lst = Vec::with_capacity(capacity);
            for event_ptr_cell in event_ptrs.iter_mut().take(capacity) {
                let event_ptr = MidiVSTConverter::allocate_event();
                *event_ptr_cell = event_ptr;
                events_lst.push(Box::from_raw(*event_ptr_cell));
            }

            Self {
                events: Box::from_raw(events_ptr),
                events_lst,
                capacity,
            }
        }
    }
/// Create a new MidiVSTConverter with capacity.
///
/// Will pre-allocate buffers.
Create a new MidiVSTConverter with capacity.
Will pre-allocate buffers.
Create a new MidiVSTConverter with capacity . Will pre - allocate buffers .
pub fn new(capacity: usize) -> Self {
        unsafe {
            let events_ptr = MidiVSTConverter::allocate_events(capacity);
            let event_ptrs = std::slice::from_raw_parts_mut(
                &mut (*events_ptr).events[0] as *mut *mut _ as *mut *mut _,
                capacity,
            );
            let mut events_lst = Vec::with_capacity(capacity);
            for event_ptr_cell in event_ptrs.iter_mut().take(capacity) {
                let event_ptr = MidiVSTConverter::allocate_event();
                *event_ptr_cell = event_ptr;
                events_lst.push(Box::from_raw(*event_ptr_cell));
            }
            Self {
                events: Box::from_raw(events_ptr),
                events_lst,
                capacity,
            }
        }
    }
pub fn new ( capacity : usize ) -> Self { unsafe { let events_ptr = MidiVSTConverter :: allocate_events ( capacity ) ; let event_ptrs = std :: slice :: from_raw_parts_mut ( & mut ( * events_ptr ) . events [ 0 ] as * mut * mut _ as * mut * mut _ , capacity , ) ; let mut events_lst = Vec :: with_capacity ( capacity ) ; for event_ptr_cell in event_ptrs . iter_mut ( ) . take ( capacity ) { let event_ptr = MidiVSTConverter :: allocate_event ( ) ; * event_ptr_cell = event_ptr ; events_lst . push ( Box :: from_raw ( * event_ptr_cell ) ) ; } Self { events : Box :: from_raw ( events_ptr ) , events_lst , capacity , } } }
Create a new MidiVSTConverter with capacity.
Create a new MidiVSTConverter with capacity .
capacity
usize
capacity
usize