pub struct SuperFrames(pub u64);Expand description
Unit of time length (of a single de-interleaved channel) in super-frames.
A “super-frame” is a unit of time that is exactly 1 / 508,032,000 of a second. This number happens to be nicely divisible by all common sampling rates, allowing changes to sample rate in a project to be a lossless process.
Tuple Fields§
§0: u64Implementations§
Source§impl SuperFrames
impl SuperFrames
Sourcepub fn new(super_frames: u64) -> Self
pub fn new(super_frames: u64) -> Self
super_frames- The number of super-frames
A “super-frame” is a unit of time equal to 1 / 508,032,000 of a second. This number was chosen
because it is nicely divisible by a whole slew of factors including 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 24, 32, 64, 128, 256, 512, and 1920, as well as common sampling
rates such as 22050, 24000, 44100, 48000, 88200, 96000, 176400, and 192000. This ensures that
any recording of frame data in this format will always be at-least sample-accurate.
Sourcepub fn from_seconds(seconds: Seconds) -> Self
pub fn from_seconds(seconds: Seconds) -> Self
Get the time in SuperFrames from the time in Seconds
Note that this conversion is NOT lossless.
If the seconds value is negative, then the SuperFrames’s values will be 0.
Sourcepub fn from_frames(frames: Frames, sample_rate: SampleRate) -> Self
pub fn from_frames(frames: Frames, sample_rate: SampleRate) -> Self
Get the time in SuperFrames from the time in Frames.
This conversion IS lossless if the sample rate happens to be equal to one of the common
sample rates: 22050, 24000, 44100, 48000, 88200, 96000, 176400, or 192000. This
conversion is NOT lossless otherwise.
Sourcepub fn to_seconds(&self) -> Seconds
pub fn to_seconds(&self) -> Seconds
Convert to the corresponding time in Seconds.
Note that this conversion is NOT lossless.
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.
Sourcepub fn to_nearest_frame_round(&self, sample_rate: SampleRate) -> Frames
pub fn to_nearest_frame_round(&self, sample_rate: SampleRate) -> Frames
Convert to the corresponding time length in Frames from the given SampleRate,
rounded to the nearest frame.
Note that this conversion is NOT lossless.
Sourcepub fn to_nearest_frame_floor(&self, sample_rate: SampleRate) -> Frames
pub fn to_nearest_frame_floor(&self, sample_rate: SampleRate) -> Frames
Convert to the corresponding time length in Frames from the given SampleRate,
floored to the nearest frame.
Note that this conversion is NOT lossless.
Sourcepub fn to_nearest_frame_ceil(&self, sample_rate: SampleRate) -> Frames
pub fn to_nearest_frame_ceil(&self, sample_rate: SampleRate) -> Frames
Convert to the corresponding time length in Frames from the given SampleRate,
ceil-ed to the nearest frame.
Note that this conversion is NOT lossless.
Trait Implementations§
Source§impl Add for SuperFrames
impl Add for SuperFrames
Source§impl AddAssign for SuperFrames
impl AddAssign for SuperFrames
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+= operation. Read moreSource§impl Clone for SuperFrames
impl Clone for SuperFrames
Source§fn clone(&self) -> SuperFrames
fn clone(&self) -> SuperFrames
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SuperFrames
impl Debug for SuperFrames
Source§impl Default for SuperFrames
impl Default for SuperFrames
Source§impl Hash for SuperFrames
impl Hash for SuperFrames
Source§impl Mul<u64> for SuperFrames
impl Mul<u64> for SuperFrames
Source§impl MulAssign<u64> for SuperFrames
impl MulAssign<u64> for SuperFrames
Source§fn mul_assign(&mut self, other: u64)
fn mul_assign(&mut self, other: u64)
*= operation. Read moreSource§impl PartialEq for SuperFrames
impl PartialEq for SuperFrames
Source§impl PartialOrd for SuperFrames
impl PartialOrd for SuperFrames
Source§impl Sub for SuperFrames
impl Sub for SuperFrames
Source§impl SubAssign for SuperFrames
impl SubAssign for SuperFrames
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
-= operation. Read more