pub struct TempoCurve { /* private fields */ }Expand description
A tempo curve: a programmed change in tempo over a duration.
Like a musician’s accelerando or ritardando, a TempoCurve smoothly
transitions from one tempo to another over a given time span.
Implementations§
Source§impl TempoCurve
impl TempoCurve
Sourcepub fn new(start_bpm: f64, end_bpm: f64, duration_beats: u32) -> Self
pub fn new(start_bpm: f64, end_bpm: f64, duration_beats: u32) -> Self
Create a new tempo curve.
Sourcepub fn rubato(base_bpm: f64, fluctuation: f64, duration_beats: u32) -> Self
pub fn rubato(base_bpm: f64, fluctuation: f64, duration_beats: u32) -> Self
Create a rubato-shaped curve (free fluctuation).
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Label the curve.
Sourcepub fn bpm_at_beat(&self, beat: f64) -> f64
pub fn bpm_at_beat(&self, beat: f64) -> f64
Get the BPM at a given beat position (linear interpolation).
Sourcepub fn bpm_at_position(&self, pos: f64) -> f64
pub fn bpm_at_position(&self, pos: f64) -> f64
Get the BPM at a given normalized position (0.0 = start, 1.0 = end). Uses ease-in-ease-out for smoother transitions.
Sourcepub fn shape(&self) -> CurveShape
pub fn shape(&self) -> CurveShape
The shape of the curve.
Sourcepub fn duration_beats(&self) -> u32
pub fn duration_beats(&self) -> u32
Duration in beats.
Sourcepub fn is_accelerando(&self) -> bool
pub fn is_accelerando(&self) -> bool
Is the curve speeding up?
Sourcepub fn is_ritardando(&self) -> bool
pub fn is_ritardando(&self) -> bool
Is the curve slowing down?
Trait Implementations§
Source§impl Clone for TempoCurve
impl Clone for TempoCurve
Source§fn clone(&self) -> TempoCurve
fn clone(&self) -> TempoCurve
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 TempoCurve
impl RefUnwindSafe for TempoCurve
impl Send for TempoCurve
impl Sync for TempoCurve
impl Unpin for TempoCurve
impl UnsafeUnpin for TempoCurve
impl UnwindSafe for TempoCurve
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