pub struct BeatGrid {
pub beats: Vec<usize>,
pub beats_fractional: Vec<f64>,
pub bpm: f64,
pub sample_rate: u32,
}Expand description
Beat grid information for a 4/4 track.
Fields§
§beats: Vec<usize>Sample positions of detected beat onsets (integer, for backward compatibility with existing code that indexes into sample buffers).
beats_fractional: Vec<f64>Fractional-sample beat positions for sub-sample precision.
Length matches beats; each value is a refinement of the
corresponding integer beat position.
bpm: f64Estimated BPM.
sample_rate: u32Sample rate.
Implementations§
Source§impl BeatGrid
impl BeatGrid
Sourcepub fn beat_interval_samples(&self) -> f64
pub fn beat_interval_samples(&self) -> f64
Returns the interval between beats in samples.
Sourcepub fn snap_to_grid(&self, position: usize) -> usize
pub fn snap_to_grid(&self, position: usize) -> usize
Snaps a sample position to the nearest beat grid position.
Sourcepub fn snap_to_grid_fractional(&self, position: f64) -> f64
pub fn snap_to_grid_fractional(&self, position: f64) -> f64
Snaps a sample position to the nearest fractional beat grid position. Returns a sub-sample-accurate position.
Trait Implementations§
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