pub struct Seconds(pub f64);Expand description
Unit of time in “Seconds”
Tuple Fields§
§0: f64Implementations§
Source§impl Seconds
impl Seconds
pub fn new(seconds: f64) -> Self
pub fn as_f32(&self) -> f32
Sourcepub fn from_frames(sample_time: Frames, sample_rate: SampleRate) -> Self
pub fn from_frames(sample_time: Frames, sample_rate: SampleRate) -> Self
Creates a new time in Seconds from Frames and a SampleRate.
Note that this conversion is NOT lossless.
Sourcepub fn from_super_frames(super_frame_time: SuperFrames) -> Self
pub fn from_super_frames(super_frame_time: SuperFrames) -> Self
Creates a new time in Seconds from SuperFrames.
Note that this conversion is NOT lossless.
Sourcepub fn to_nearest_frame_round(&self, sample_rate: SampleRate) -> Frames
pub fn to_nearest_frame_round(&self, sample_rate: SampleRate) -> Frames
Convert to discrete Frames with the given SampleRate. This will
be rounded to the nearest sample.
Note that this conversion is NOT lossless.
If the seconds value is negative, then Frames(0) will be returned instead.
Sourcepub fn to_nearest_frame_floor(&self, sample_rate: SampleRate) -> Frames
pub fn to_nearest_frame_floor(&self, sample_rate: SampleRate) -> Frames
Convert to discrete Frames with the given SampleRate. This will
be floored to the nearest sample.
Note that this conversion is NOT lossless.
If the seconds value is negative, then Frames(0) will be returned instead.
Sourcepub fn to_nearest_frame_ceil(&self, sample_rate: SampleRate) -> Frames
pub fn to_nearest_frame_ceil(&self, sample_rate: SampleRate) -> Frames
Convert to discrete Frames with the given SampleRate. This will
be ceil-ed to the nearest sample.
Note that this conversion is NOT lossless.
If the seconds value is negative, then Frames(0) will be returned instead.
Sourcepub fn to_sub_frames(&self, sample_rate: SampleRate) -> (Frames, f64)
pub fn to_sub_frames(&self, sample_rate: SampleRate) -> (Frames, f64)
Convert to discrete Frames given the SampleRate floored to the nearest
sample, while also return the fractional sub-sample part.
Note that this conversion is NOT lossless.
If the seconds value is negative, then (Frames(0), 0.0) will be returned instead.
Sourcepub fn to_nearest_super_frame_round(&self) -> SuperFrames
pub fn to_nearest_super_frame_round(&self) -> SuperFrames
Convert to discrete SuperFrames. This will
be rounded to the nearest super-frame.
Note that this conversion is NOT lossless.
If the seconds value is negative, then the SuperFrames’s value will be 0.
Sourcepub fn to_nearest_super_frame_floor(&self) -> SuperFrames
pub fn to_nearest_super_frame_floor(&self) -> SuperFrames
Convert to discrete SuperFrames. This will
be floored to the nearest super-frame.
Note that this conversion is NOT lossless.
If the seconds value is negative, then the SuperFrames’s values will be 0.
Sourcepub fn to_nearest_super_frame_ceil(&self) -> SuperFrames
pub fn to_nearest_super_frame_ceil(&self) -> SuperFrames
Convert to discrete SuperFrames. This will
be ceil-ed to the nearest super-frame.
Note that this conversion is NOT lossless.
If the seconds value is negative, then the SuperFrames’s values will be 0.
Sourcepub fn to_sub_super_frames(&self) -> (SuperFrames, f64)
pub fn to_sub_super_frames(&self) -> (SuperFrames, f64)
Convert to discrete Frames floored to the nearest
super-frame, while also return the fractional sub-super-frame part.
Note that this conversion is NOT lossless.
If the seconds value is negative, then the SuperFrames’s values and the
fractional value will both be 0.
Sourcepub fn to_musical(&self, bpm: f64) -> MusicalTime
pub fn to_musical(&self, bpm: f64) -> MusicalTime
Convert to the corresponding MusicalTime.
Note that this conversion is NOT lossless.
Trait Implementations§
Source§impl AddAssign for Seconds
impl AddAssign for Seconds
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+= operation. Read moreSource§impl DivAssign for Seconds
impl DivAssign for Seconds
Source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
/= operation. Read moreSource§impl MulAssign for Seconds
impl MulAssign for Seconds
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
*= operation. Read moreSource§impl PartialOrd for Seconds
impl PartialOrd for Seconds
Source§impl SubAssign for Seconds
impl SubAssign for Seconds
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
-= operation. Read more