Struct Spec

Source
pub struct Spec {
    pub channels: u16,
    pub channel_mask: u32,
    pub sample_rate: u32,
    pub bits_per_sample: u16,
    pub sample_format: SampleFormat,
}
Expand description
  • The spec info for a generic audio file.

Fields§

§channels: u16
  • Num channels
§channel_mask: u32
  • The channel mask indicates the position of the speakers.
§sample_rate: u32
  • The sample rate. How many audio frames are to be played in a second.
§bits_per_sample: u16
  • For PCM, this indicates how many bits is for a sample.
§sample_format: SampleFormat
  • The roughly described sample format

Implementations§

Source§

impl Spec

Source

pub fn new() -> Self

Source

pub fn get_sample_type(&self) -> WaveSampleType

  • Get the concrete sample type
Source

pub fn guess_channel_mask(&self) -> Result<u32, AudioError>

  • Guess the channel mask
Source

pub fn channel_mask_to_speaker_positions(&self) -> Vec<u32>

  • Break down a channel mask to the speaker positions.
Source

pub fn channel_mask_to_speaker_positions_descs(&self) -> Vec<&'static str>

  • Break down a channel mask to the speaker position description strings.
Source

pub fn verify_for_pcm(&self) -> Result<(), AudioError>

  • Check if this spec is good for encoding PCM format.
Source

pub fn is_channel_mask_valid(&self) -> bool

  • Check if the channel mask matches the channel number.

Trait Implementations§

Source§

impl Clone for Spec

Source§

fn clone(&self) -> Spec

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 Spec

Source§

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

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

impl Default for Spec

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for Spec

Auto Trait Implementations§

§

impl Freeze for Spec

§

impl RefUnwindSafe for Spec

§

impl Send for Spec

§

impl Sync for Spec

§

impl Unpin for Spec

§

impl UnwindSafe for Spec

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.