pub struct RingTrackedMidiBuffer { /* private fields */ }Expand description
A fixed-capacity ring buffer of TrackedMidiEvents usable as a
TrackedMidiSource, tracking the highest track index seen.
Implementations§
Source§impl RingTrackedMidiBuffer
impl RingTrackedMidiBuffer
Sourcepub fn new(tpq: u32, capacity: usize) -> Result<Self, LiveMidiError>
pub fn new(tpq: u32, capacity: usize) -> Result<Self, LiveMidiError>
Creates a tracked buffer at tpq resolution holding up to capacity
events.
Fails with LiveMidiError::ZeroCapacity when capacity is zero.
Sourcepub fn last_track(&self) -> usize
pub fn last_track(&self) -> usize
Returns the track index of the most recently read event.
Sourcepub fn dropped_events(&self) -> usize
pub fn dropped_events(&self) -> usize
Returns the running count of events dropped due to overflow.
Sourcepub fn snapshot(&self) -> Vec<TrackedMidiEvent>
pub fn snapshot(&self) -> Vec<TrackedMidiEvent>
Returns a copy of the currently buffered tracked events.
Sourcepub fn push_tracked_event(&mut self, event: TrackedMidiEvent)
pub fn push_tracked_event(&mut self, event: TrackedMidiEvent)
Pushes a tracked event, updating the track count and dropping the oldest event if the buffer is full.
Trait Implementations§
Source§impl Clone for RingTrackedMidiBuffer
impl Clone for RingTrackedMidiBuffer
Source§fn clone(&self) -> RingTrackedMidiBuffer
fn clone(&self) -> RingTrackedMidiBuffer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RingTrackedMidiBuffer
impl Debug for RingTrackedMidiBuffer
Source§impl MidiSource for RingTrackedMidiBuffer
impl MidiSource for RingTrackedMidiBuffer
Source§impl TrackedMidiSource for RingTrackedMidiBuffer
impl TrackedMidiSource for RingTrackedMidiBuffer
Source§fn last_track(&self) -> usize
fn last_track(&self) -> usize
Returns the track index of the most recently yielded event.
Source§fn next_tracked(&mut self) -> Result<Option<TrackedMidiEvent>, Self::Err>
fn next_tracked(&mut self) -> Result<Option<TrackedMidiEvent>, Self::Err>
Returns the next event together with its track tag.
Auto Trait Implementations§
impl Freeze for RingTrackedMidiBuffer
impl RefUnwindSafe for RingTrackedMidiBuffer
impl Send for RingTrackedMidiBuffer
impl Sync for RingTrackedMidiBuffer
impl Unpin for RingTrackedMidiBuffer
impl UnsafeUnpin for RingTrackedMidiBuffer
impl UnwindSafe for RingTrackedMidiBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more