FmtChunk

Struct FmtChunk 

Source
pub struct FmtChunk { /* private fields */ }
Expand description

The fmt chunk contains information about the audio format.

  • Channel type: mono, stereo, 5.1, etc.
  • Channel number: 1 for mono, 2 for stereo, etc.
  • Sampling frequency: the DSD sampling frequency.
  • Bits per sample: whether the samples are big or little endian encoded.
  • Block size per channel: this should always be 4096 bytes.

Implementations§

Source§

impl FmtChunk

Source

pub fn channel_type(&self) -> &ChannelType

Return a reference to the ChannelType.

Source

pub fn channel_num(&self) -> u32

Return the number of channels. This should be in the range 1 to 6.

Source

pub fn sampling_frequency(&self) -> u32

Return the sampling freqency. DSD sampling frequencies are much higher than PCM because of the 1-bit sampling, so you should get values like:

  • 2822400 Hz for DSD64
  • 5644800 Hz for DSD128
  • 11289600 Hz for DSD256

and so on.

Source

pub fn bits_per_sample(&self) -> u32

Returns the bits_per_sample field. This is a bit of a misnomer in my opinion, but that’s what’s in the DSF specification. If it is equal to 1 then the sample data is stored least significant bit first. If it is equal to 8 then the sample data is stored most significant bit first.

Source

pub fn sample_count(&self) -> u64

Return the number of DSD samples per channel.

Source

pub fn block_size_per_channel(&self) -> u32

Return the block size per channel in bytes. This is fixed and should always be 4096 bytes.

Trait Implementations§

Source§

impl Display for FmtChunk

Source§

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

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

impl TryFrom<[u8; 52]> for FmtChunk

Source§

type Error = Error

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

fn try_from(buffer: [u8; 52]) -> Result<Self, Self::Error>

Performs the conversion.

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.