Enum libosu::TimeLocation [−][src]
pub enum TimeLocation { Absolute(AbsoluteTime), Relative(RelativeTime), }
A struct representing a precise location in time.
This enum represents a timestamp by either an absolute timestamp (milliseconds), or a tuple
(t, m, f) where t is the TimingPoint
that it's relative to, m is the measure number
from within this timing section, and f is a fraction (actually implemented with
num_rational::Ratio
) that represents how far into the measure this note appears.
When possible, prefer to stack measures. The value of f should not ever reach 1; instead, opt to use measure numbers for whole amounts of measures. For example, 1 measure + 5 / 4 should be represented as 2 measures + 1 / 4 instead.
Variants
Absolute(AbsoluteTime)
Absolute timing in terms of number of milliseconds since the beginning of the audio file.
Note that because this is an i32
, the time is allowed to be negative.
Relative(RelativeTime)
Relative timing based on an existing TimingPoint. The lifetime of this TimeLocation thus depends on the lifetime of the map.
Methods
impl TimeLocation
[src]
impl TimeLocation
pub fn into_absolute(self) -> TimeLocation
[src]
pub fn into_absolute(self) -> TimeLocation
Converts any TimeLocation
into an absolute one.
pub fn as_milliseconds(&self) -> i32
[src]
pub fn as_milliseconds(&self) -> i32
Converts any TimeLocation
into an absolute time in milliseconds from the beginning of the
audio file.
pub fn into_relative(self, tp: &TimingPoint) -> TimeLocation
[src]
pub fn into_relative(self, tp: &TimingPoint) -> TimeLocation
Converts any TimeLocation
into a relative one.
pub fn approximate(
&self,
time: &TimeLocation,
bpm: f64,
meter: u32
) -> (u32, Ratio<u32>)
[src]
pub fn approximate(
&self,
time: &TimeLocation,
bpm: f64,
meter: u32
) -> (u32, Ratio<u32>)
Converts any TimeLocation
into a relative time tuple given a TimingPoint
.
Trait Implementations
impl Clone for TimeLocation
[src]
impl Clone for TimeLocation
fn clone(&self) -> TimeLocation
[src]
fn clone(&self) -> TimeLocation
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for TimeLocation
[src]
impl Debug for TimeLocation
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Eq for TimeLocation
[src]
impl Eq for TimeLocation
impl PartialEq for TimeLocation
[src]
impl PartialEq for TimeLocation
fn eq(&self, other: &TimeLocation) -> bool
[src]
fn eq(&self, other: &TimeLocation) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Ord for TimeLocation
[src]
impl Ord for TimeLocation
fn cmp(&self, other: &TimeLocation) -> Ordering
[src]
fn cmp(&self, other: &TimeLocation) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialOrd for TimeLocation
[src]
impl PartialOrd for TimeLocation
fn partial_cmp(&self, other: &TimeLocation) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &TimeLocation) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Into<TimeLocation> for i32
[src]
impl Into<TimeLocation> for i32
fn into(self) -> TimeLocation
[src]
fn into(self) -> TimeLocation
Performs the conversion.
impl<'a> Into<TimeLocation> for &'a TimeLocation
[src]
impl<'a> Into<TimeLocation> for &'a TimeLocation
fn into(self) -> TimeLocation
[src]
fn into(self) -> TimeLocation
Performs the conversion.
Auto Trait Implementations
impl Send for TimeLocation
impl Send for TimeLocation
impl Sync for TimeLocation
impl Sync for TimeLocation