pub struct MidiBeat { /* private fields */ }Expand description
An exact, non-negative position measured in MIDI quarter-note beats.
The reduced rational representation avoids rounding tuplets or rebased ticks. MIDI tempo always uses a quarter note as its beat unit, independent of the notated time signature.
Implementations§
Source§impl MidiBeat
impl MidiBeat
Sourcepub fn new(numerator: i128, denominator: i128) -> Result<Self, MidiError>
pub fn new(numerator: i128, denominator: i128) -> Result<Self, MidiError>
Builds numerator / denominator quarter-note beats and reduces it.
Negative values and a zero denominator are rejected because SMF tempo timelines begin at tick zero.
Sourcepub const fn denominator(self) -> i128
pub const fn denominator(self) -> i128
Returns the reduced, positive denominator in quarter-note beats.
Trait Implementations§
impl Copy for MidiBeat
impl Eq for MidiBeat
Source§impl Ord for MidiBeat
impl Ord for MidiBeat
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for MidiBeat
impl PartialOrd for MidiBeat
impl StructuralPartialEq for MidiBeat
Auto Trait Implementations§
impl Freeze for MidiBeat
impl RefUnwindSafe for MidiBeat
impl Send for MidiBeat
impl Sync for MidiBeat
impl Unpin for MidiBeat
impl UnsafeUnpin for MidiBeat
impl UnwindSafe for MidiBeat
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