Struct reaper_medium::MidiInput
source · [−]pub struct MidiInput(_);
Expand description
Pointer to a MIDI input device.
Implementations
sourceimpl MidiInput
impl MidiInput
sourcepub fn get_read_buf(&mut self) -> &mut BorrowedMidiEventList
pub fn get_read_buf(&mut self) -> &mut BorrowedMidiEventList
Returns the list of MIDI events which are currently in the buffer.
This must only be called in the real-time audio thread! See get_midi_input()
.
Design
In the past this function was unsafe and expected a closure which let the consumer do
something with the event list. All of that is not necessary anymore since we ensure in
get_midi_input()
that we only ever publish valid MidiInput
instances, and those only
by a very short-lived reference that’s not possible to cache anywhere. That makes it
possible to bind the lifetime of the event list to the one of the MidiInput
and
everything is fine!
Returning an owned event list would be wasteful because we would need to copy all events first. That would be especially bad because this code is supposed to run in the audio thread and therefore has real-time requirements.
Trait Implementations
impl Eq for MidiInput
impl StructuralEq for MidiInput
impl StructuralPartialEq for MidiInput
Auto Trait Implementations
impl RefUnwindSafe for MidiInput
impl !Send for MidiInput
impl !Sync for MidiInput
impl Unpin for MidiInput
impl UnwindSafe for MidiInput
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read moresourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more