[][src]Struct music_timer::music_time_counter::MusicTimeCounter

pub struct MusicTimeCounter { /* fields omitted */ }

Data structure that handles advancing music time within a time signature.

Methods

impl MusicTimeCounter[src]

pub fn new(time_signature: TimeSignature) -> Self[src]

Create a new MusicTimeCounter with a TimeSignature.

Arguments

  • time_signature - The TimeSignature the MusicTimeCounter is constrained by.

Example

use music_timer::{time_signature::TimeSignature, music_time_counter::MusicTimeCounter};
let timer = MusicTimeCounter::new(TimeSignature::new(3, 4));

pub fn current_time(&self) -> &MusicTime[src]

Gets the current time of the counter.

pub fn advance_beat(&mut self)[src]

Advance this counter by 1 beat.

pub fn advance_beat_interval(&mut self)[src]

Advance this counter by 1 beat interval.

pub fn beat_target_frames(&self, bpm: f32) -> Duration[src]

Gets the time duration between beats.

Arguments

  • bpm - Beats per minute

pub fn beat_interval_target_frames(&self, bpm: f32) -> Duration[src]

Gets the time duration between beat intervals.

Arguments

  • bpm - Beats per minute.

pub fn set_current_time(&mut self, current_time: MusicTime) -> &mut Self[src]

Set the current music time of the counter.

Arguments

  • current_time - The new current time to set counter to.

Trait Implementations

impl Debug for MusicTimeCounter[src]

impl Default for MusicTimeCounter[src]

fn default() -> Self[src]

Default MusicTimeCounter is created with a default TimeSignature.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.