pub struct TempoLeader { /* private fields */ }Expand description
Set tempo for a group of agents.
A TempoLeader broadcasts tempo information so that followers can
synchronize their work cycles.
Implementations§
Source§impl TempoLeader
impl TempoLeader
Sourcepub fn new(leader_id: impl Into<String>, initial_tempo: TempoMarking) -> Self
pub fn new(leader_id: impl Into<String>, initial_tempo: TempoMarking) -> Self
Create a new tempo leader.
Sourcepub fn set_rubato(&mut self, enabled: bool)
pub fn set_rubato(&mut self, enabled: bool)
Enable or disable rubato for the group.
Sourcepub fn add_follower(&mut self, follower_id: impl Into<String>, offset_bpm: f64)
pub fn add_follower(&mut self, follower_id: impl Into<String>, offset_bpm: f64)
Register a follower with an optional tempo offset.
Sourcepub fn remove_follower(&mut self, follower_id: &str) -> bool
pub fn remove_follower(&mut self, follower_id: &str) -> bool
Remove a follower.
Sourcepub fn set_tempo(&mut self, tempo: TempoMarking)
pub fn set_tempo(&mut self, tempo: TempoMarking)
Change the tempo.
Sourcepub fn start_curve(&mut self, curve: TempoCurve)
pub fn start_curve(&mut self, curve: TempoCurve)
Start a tempo curve (accelerando/ritardando).
Sourcepub fn advance_curve(&mut self, step: f64) -> Option<f64>
pub fn advance_curve(&mut self, step: f64) -> Option<f64>
Advance the curve by a step (0.0–1.0 increment). Returns the current BPM from the curve.
Sourcepub fn effective_bpm(&self) -> f64
pub fn effective_bpm(&self) -> f64
Get the effective BPM, accounting for any active curve.
Sourcepub fn tempo_for_follower(&self, follower_id: &str) -> f64
pub fn tempo_for_follower(&self, follower_id: &str) -> f64
Get the tempo for a specific follower (base ± offset).
Sourcepub fn follower_count(&self) -> usize
pub fn follower_count(&self) -> usize
Number of followers.
Sourcepub fn current_tempo(&self) -> &TempoMarking
pub fn current_tempo(&self) -> &TempoMarking
Current tempo marking.
Sourcepub fn rubato_enabled(&self) -> bool
pub fn rubato_enabled(&self) -> bool
Whether rubato is enabled.
Sourcepub fn curve_active(&self) -> bool
pub fn curve_active(&self) -> bool
Whether a curve is active.
Trait Implementations§
Source§impl Clone for TempoLeader
impl Clone for TempoLeader
Source§fn clone(&self) -> TempoLeader
fn clone(&self) -> TempoLeader
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 TempoLeader
impl RefUnwindSafe for TempoLeader
impl Send for TempoLeader
impl Sync for TempoLeader
impl Unpin for TempoLeader
impl UnsafeUnpin for TempoLeader
impl UnwindSafe for TempoLeader
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