pub struct BeatGrid {
pub bpm: f64,
pub phase_offset_ms: f64,
}Expand description
A regular beat grid defined by a tempo.
Fields§
§bpm: f64Tempo in beats per minute.
phase_offset_ms: f64Phase offset of the first beat in milliseconds from the stream start.
Implementations§
Source§impl BeatGrid
impl BeatGrid
Sourcepub fn with_phase(bpm: f64, phase_offset_ms: f64) -> Self
pub fn with_phase(bpm: f64, phase_offset_ms: f64) -> Self
Creates a beat grid with an explicit phase offset.
Sourcepub fn interval_ms(&self) -> f64
pub fn interval_ms(&self) -> f64
Returns the interval between consecutive beats in milliseconds.
Sourcepub fn beat_time_ms(&self, beat_index: u32) -> f64
pub fn beat_time_ms(&self, beat_index: u32) -> f64
Returns the timestamp (ms from stream start) of the n-th beat (0-indexed).
Sourcepub fn nearest_beat(&self, time_ms: f64) -> u32
pub fn nearest_beat(&self, time_ms: f64) -> u32
Returns the nearest beat index for a given timestamp (ms).
Trait Implementations§
impl Copy for BeatGrid
impl StructuralPartialEq for BeatGrid
Auto Trait Implementations§
impl Freeze for BeatGrid
impl RefUnwindSafe for BeatGrid
impl Send for BeatGrid
impl Sync for BeatGrid
impl Unpin for BeatGrid
impl UnsafeUnpin for BeatGrid
impl UnwindSafe for BeatGrid
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.