pub struct TempoFollower { /* private fields */ }Expand description
Track the tempo of other agents and follow along.
A TempoFollower observes timestamps of another agent’s actions and
infers their current tempo, allowing this agent to synchronize.
Implementations§
Source§impl TempoFollower
impl TempoFollower
Sourcepub fn with_window_size(self, size: usize) -> Self
pub fn with_window_size(self, size: usize) -> Self
Set the observation window size.
Sourcepub fn with_smoothing(self, smoothing: f64) -> Self
pub fn with_smoothing(self, smoothing: f64) -> Self
Set the smoothing factor.
Sourcepub fn observe_beat(&mut self)
pub fn observe_beat(&mut self)
Observe a beat from the leader.
Sourcepub fn observe_beat_at(&mut self, time: Instant)
pub fn observe_beat_at(&mut self, time: Instant)
Observe a beat at a specific time (for testing).
Sourcepub fn estimated_bpm(&self) -> Option<f64>
pub fn estimated_bpm(&self) -> Option<f64>
Get the estimated BPM of the leader.
Sourcepub fn observed_count(&self) -> usize
pub fn observed_count(&self) -> usize
Number of observed beats.
Sourcepub fn sync_offset(&self, our_bpm: f64) -> Option<f64>
pub fn sync_offset(&self, our_bpm: f64) -> Option<f64>
Compute the sync offset: how far off our tempo is from the leader’s.
Trait Implementations§
Source§impl Clone for TempoFollower
impl Clone for TempoFollower
Source§fn clone(&self) -> TempoFollower
fn clone(&self) -> TempoFollower
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 moreAuto Trait Implementations§
impl Freeze for TempoFollower
impl RefUnwindSafe for TempoFollower
impl Send for TempoFollower
impl Sync for TempoFollower
impl Unpin for TempoFollower
impl UnsafeUnpin for TempoFollower
impl UnwindSafe for TempoFollower
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