Skip to main content

SmfDivision

Enum SmfDivision 

Source
pub enum SmfDivision {
    Metrical {
        ticks_per_quarter: NonZeroU16,
    },
    Smpte {
        frames_per_second: SmpteRate,
        ticks_per_frame: NonZeroU8,
    },
}
Expand description

The lossless time-division field from an SMF header.

Variants§

§

Metrical

Metrical timing in ticks per quarter note.

Fields

§ticks_per_quarter: NonZeroU16

Non-zero ticks per quarter note.

§

Smpte

Timecode timing in subdivisions of an SMPTE frame.

Fields

§frames_per_second: SmpteRate

One of the four frame rates permitted by SMF.

§ticks_per_frame: NonZeroU8

Non-zero subdivisions per frame.

Implementations§

Source§

impl SmfDivision

Source

pub const fn metrical(ticks_per_quarter: u16) -> Option<Self>

Constructs a metrical division, returning None for zero or a value with the SMPTE high bit set.

Source

pub const fn smpte( frames_per_second: SmpteRate, ticks_per_frame: u8, ) -> Option<Self>

Constructs an SMPTE division, returning None for zero ticks per frame.

Source

pub const fn ticks_per_quarter(self) -> Option<NonZeroU16>

Returns metrical ticks per quarter note, or None for SMPTE timing.

Source

pub const fn ticks_per_second_ratio(self) -> Option<(u32, u32)>

Returns the exact number of SMF ticks per second as a ratio, or None for metrical timing whose tempo is carried by events.

Source

pub const fn event_time_base(self) -> u32

Returns the resolution used in each event’s TickTime.

For metrical files this is ticks per quarter note. For SMPTE files it is nominal ticks per second (30 fps for the -29 drop-frame code); ticks_per_second_ratio retains the exact 30_000 / 1_001 rate for duration calculations.

Trait Implementations§

Source§

impl Clone for SmfDivision

Source§

fn clone(&self) -> SmfDivision

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SmfDivision

Source§

impl Debug for SmfDivision

Source§

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

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

impl Eq for SmfDivision

Source§

impl Hash for SmfDivision

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SmfDivision

Source§

fn eq(&self, other: &SmfDivision) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SmfDivision

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.