Struct midi_file::file::MicrosecondsPerQuarter
source · pub struct MicrosecondsPerQuarter(/* private fields */);
Expand description
In MIDI tempos are given as microseconds per quarter note. Tempo microseconds are given by a
6-byte integer, hence the weird upper-bound (16,777,215). The default tempo is 120 beats per
minute, which is 500_000
microseconds per beat. The minimum value is 1
since 0
microseconds per beat would be an infinitely fast tempo.
§Examples
§Quarter Note at 92 Beats per Minute
- that is 1 minute ÷ 92 => 0.010869565217391 minutes per beat (mpb)
- 0.010869565217391 mpb * 60 seconds per minute => 0.652173913043478 seconds per beat (spb)
- 0.652173913043478 spb * 1000000 => 652173.91304347803816 microseconds per beat
§Quarter Note at 120 Beats per Minute
- that is 1 minute ÷ 120 beats per minute => 0.008333333333333 minutes per beat (mpb)
- 0.008333333333333 mpb * 60 seconds => 0.5 seconds per beat (spb)
- 0.652173913043478 spb * 1000000 => 500000 microseconds per beat
Implementations§
Trait Implementations§
source§impl Clone for MicrosecondsPerQuarter
impl Clone for MicrosecondsPerQuarter
source§fn clone(&self) -> MicrosecondsPerQuarter
fn clone(&self) -> MicrosecondsPerQuarter
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for MicrosecondsPerQuarter
impl Debug for MicrosecondsPerQuarter
source§impl Default for MicrosecondsPerQuarter
impl Default for MicrosecondsPerQuarter
source§impl Display for MicrosecondsPerQuarter
impl Display for MicrosecondsPerQuarter
source§impl From<MicrosecondsPerQuarter> for u32
impl From<MicrosecondsPerQuarter> for u32
source§fn from(value: MicrosecondsPerQuarter) -> u32
fn from(value: MicrosecondsPerQuarter) -> u32
Converts to this type from the input type.
source§impl From<u32> for MicrosecondsPerQuarter
impl From<u32> for MicrosecondsPerQuarter
source§impl Hash for MicrosecondsPerQuarter
impl Hash for MicrosecondsPerQuarter
source§impl Ord for MicrosecondsPerQuarter
impl Ord for MicrosecondsPerQuarter
source§fn cmp(&self, other: &MicrosecondsPerQuarter) -> Ordering
fn cmp(&self, other: &MicrosecondsPerQuarter) -> Ordering
1.21.0 · 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 PartialEq for MicrosecondsPerQuarter
impl PartialEq for MicrosecondsPerQuarter
source§impl PartialOrd for MicrosecondsPerQuarter
impl PartialOrd for MicrosecondsPerQuarter
impl Copy for MicrosecondsPerQuarter
impl Eq for MicrosecondsPerQuarter
impl StructuralPartialEq for MicrosecondsPerQuarter
Auto Trait Implementations§
impl Freeze for MicrosecondsPerQuarter
impl RefUnwindSafe for MicrosecondsPerQuarter
impl Send for MicrosecondsPerQuarter
impl Sync for MicrosecondsPerQuarter
impl Unpin for MicrosecondsPerQuarter
impl UnwindSafe for MicrosecondsPerQuarter
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)