AudioDuration

Struct AudioDuration 

Source
pub struct AudioDuration { /* private fields */ }

Implementations§

Source§

impl AudioDuration

Source

pub fn new(samples: u64, sampling_frequency: u32) -> AudioDuration

Make a new AudioDuration.

Source

pub fn samples(&self) -> u64

Return the number of samples in this AudioDuration.

Source

pub fn set_samples(&mut self, samples: u64)

Set the samples for this AudioDuration.

Source

pub fn sampling_frequency(&self) -> u32

Return the sampling frequency of this AudioDuration.

Source

pub fn as_secs(&self) -> u64

Return the whole number of seconds in this AudioDuration.

Source

pub fn as_mins(&self) -> u64

Return the whole number of minutes in this AudioDuration.

Source

pub fn as_hours(&self) -> u64

Return the whole number of hours in this AudioDuration.

Source

pub fn as_days(&self) -> u64

Return the whole number of days in this AudioDuration.

Source

pub fn as_weeks(&self) -> u64

Return the whole number of weeks in this AudioDuration.

Source

pub fn subsec_samples(&self) -> u32

Return the fractional part of this AudioDuration in samples.

This will return a value in the range 0 <= subsec_samples < sampling_frequency.

Source

pub fn subsec_nanos(&self) -> u32

Return the fractional part of this AudioDuration as a whole number of nanoseconds.

Source

pub fn subsec_secs(&self) -> f64

Return the fractional part of this AudioDuration as seconds.

This will return a value in the range 0.0 <= subsec_secs < 1.0.

Source

pub fn submin_secs(&self) -> u64

Return the fractional part of minutes in seconds.

Source

pub fn subhour_mins(&self) -> u64

Return the fractional part of hours in minutes.

Source

pub fn subday_hours(&self) -> u64

Return the fractional part of days in hours.

Source

pub fn subweek_days(&self) -> u64

Return the fractional part of days in hours.

Source

pub fn duration(&self) -> Duration

Return this AudioDuration as a Duration.

Source

pub fn fmt_hhmmss_samples(&self) -> String

Return the duration as a String formatted as hh:mm:ss;samples.

Source

pub fn fmt_hhmmss(&self) -> String

Return the duration as a String formatted as hh:mm:ss.

Source

pub fn fmt_opt_hh_mmss(&self) -> String

Return the duration formatted as mm:ss if the duration is less than an hour, as hh:mm:ss otherwise.

Trait Implementations§

Source§

impl Display for AudioDuration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Into<Duration> for AudioDuration

Source§

fn into(self) -> Duration

Converts this type into the (usually inferred) input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.