Struct wav::header::Header[][src]

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,
}

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: u16channel_count: u16sampling_rate: u32bytes_per_second: u32bytes_per_sample: u16bits_per_sample: u16

Implementations

impl Header[src]

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

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

impl Clone for Header[src]

impl Copy for Header[src]

impl Debug for Header[src]

impl Default for Header[src]

impl Eq for Header[src]

impl From<[u8; 16]> for Header[src]

impl Hash for Header[src]

impl PartialEq<Header> for Header[src]

impl StructuralEq for Header[src]

impl StructuralPartialEq for Header[src]

impl TryFrom<&'_ [u8]> for Header[src]

type Error = &'static str

The type returned in the event of a conversion error.

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

Errors

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

Auto Trait Implementations

impl RefUnwindSafe for Header

impl Send for Header

impl Sync for Header

impl Unpin for Header

impl UnwindSafe for Header

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.