Skip to main content

SamplingFrequencyIndex

Struct SamplingFrequencyIndex 

Source
pub struct SamplingFrequencyIndex(/* private fields */);
Expand description

A 4-bit sampling frequency index as defined in ISO 14496-3.

Indices 0x0–0xc map to the 13 standard sampling rates (96 kHz down to 7.35 kHz). Indices 0xd–0xe are reserved. Index 0xf is excluded from this type as it signals that an explicit 24-bit frequency value follows in the bitstream instead.

Use freq to look up the sampling rate in Hz, which returns None for reserved indices.

Implementations§

Source§

impl SamplingFrequencyIndex

Source

pub const FREQ_96000: Self

96 kHz (index 0x0).

Source

pub const FREQ_88200: Self

88.2 kHz (index 0x1).

Source

pub const FREQ_64000: Self

64 kHz (index 0x2).

Source

pub const FREQ_48000: Self

48 kHz (index 0x3).

Source

pub const FREQ_44100: Self

44.1 kHz (index 0x4).

Source

pub const FREQ_32000: Self

32 kHz (index 0x5).

Source

pub const FREQ_24000: Self

24 kHz (index 0x6).

Source

pub const FREQ_22050: Self

22.05 kHz (index 0x7).

Source

pub const FREQ_16000: Self

16 kHz (index 0x8).

Source

pub const FREQ_12000: Self

12 kHz (index 0x9).

Source

pub const FREQ_11025: Self

11.025 kHz (index 0xa).

Source

pub const FREQ_8000: Self

8 kHz (index 0xb).

Source

pub const FREQ_7350: Self

7.35 kHz (index 0xc).

Source

pub const fn new(value: u8) -> Self

Creates a SamplingFrequencyIndex from a 4-bit value.

Panics if value is 0xf (the escape value) or greater than 0xe. In const context, an invalid value produces a compile-time error.

Source

pub fn freq(&self) -> Option<u32>

Returns the sampling rate in Hz, or None if the index is reserved or not yet defined.

Trait Implementations§

Source§

impl Clone for SamplingFrequencyIndex

Source§

fn clone(&self) -> SamplingFrequencyIndex

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SamplingFrequencyIndex

Source§

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

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

impl From<SamplingFrequencyIndex> for u8

Source§

fn from(v: SamplingFrequencyIndex) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for SamplingFrequencyIndex

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<u8> for SamplingFrequencyIndex

Source§

type Error = SamplingFrequencyIndexError

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

fn try_from(value: u8) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for SamplingFrequencyIndex

Source§

impl Eq for SamplingFrequencyIndex

Source§

impl StructuralPartialEq for SamplingFrequencyIndex

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.