Struct Header

Source
pub struct Header {
    pub audio_format: u16,
    pub channel_count: u16,
    pub sampling_rate: u32,
    pub bytes_per_second: u32,
    pub bytes_per_sample: u16,
    pub bits_per_sample: u16,
}
๐Ÿ‘ŽDeprecated: This project is no longer maintained, use the hound crate
Expand description

Structure for the "fmt " chunk of wave files, specifying key information about the enclosed data.

This struct supports only PCM and IEEE float data, which is to say there is no extra members for compressed format data.

Fieldsยง

ยงaudio_format: u16
๐Ÿ‘ŽDeprecated: This project is no longer maintained, use the hound crate
ยงchannel_count: u16
๐Ÿ‘ŽDeprecated: This project is no longer maintained, use the hound crate
ยงsampling_rate: u32
๐Ÿ‘ŽDeprecated: This project is no longer maintained, use the hound crate
ยงbytes_per_second: u32
๐Ÿ‘ŽDeprecated: This project is no longer maintained, use the hound crate
ยงbytes_per_sample: u16
๐Ÿ‘ŽDeprecated: This project is no longer maintained, use the hound crate
ยงbits_per_sample: u16
๐Ÿ‘ŽDeprecated: This project is no longer maintained, use the hound crate

Implementationsยง

Sourceยง

impl Header

Source

pub fn new( audio_format: u16, channel_count: u16, sampling_rate: u32, bits_per_sample: u16, ) -> Header

๐Ÿ‘ŽDeprecated: This project is no longer maintained, use the hound crate

Creates a new Header object.

ยงNote

While the crate::read and crate::write functions only support uncompressed PCM/IEEE for the audio format, the option is given here to select any audio format for custom implementations of wave features.

ยงParameters
  • audio_format - Audio format. Only WAV_FORMAT_PCM (0x01) and WAV_FORMAT_IEEE_FLOAT (0x03) are supported.
  • channel_count - Channel count. The number of channels each sample has. Generally 1 (mono) or 2 (stereo).
  • sampling_rate - Sampling rate (e.g. 44.1kHz, 48kHz, 96kHz, etc.).
  • bits_per_sample - Number of bits in each (sub-channel) sample. Generally 8, 16, 24, or 32.
ยงExample
let h = wav::Header::new(wav::header::WAV_FORMAT_PCM, 2, 48_000, 16);

Trait Implementationsยง

Sourceยง

impl Clone for Header

Sourceยง

fn clone(&self) -> Header

Returns a copy 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 Header

Sourceยง

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

Formats the value using the given formatter. Read more
Sourceยง

impl Default for Header

Sourceยง

fn default() -> Header

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl From<[u8; 16]> for Header

Sourceยง

fn from(v: [u8; 16]) -> Self

Converts to this type from the input type.
Sourceยง

impl From<Header> for [u8; 16]

Sourceยง

fn from(h: Header) -> Self

Converts to this type from the input type.
Sourceยง

impl Hash for Header

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 Header

Sourceยง

fn eq(&self, other: &Header) -> 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 Header

Sourceยง

fn try_from(v: &[u8]) -> Result<Self, Self::Error>

ยงErrors

This function will return an error if the given slice is smaller than 16 bytes.

Sourceยง

type Error = &'static str

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

impl Copy for Header

Sourceยง

impl Eq for Header

Sourceยง

impl StructuralPartialEq for Header

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.