Struct Encoder

Source
pub struct Encoder<'a> { /* private fields */ }
Expand description
  • The Encoder struct contains all of the encoder types and provides convenient functions that have generic type parameters.
  • It just translates the API to the inner encoder API.

Implementations§

Source§

impl<'a> Encoder<'a>

Source

pub fn new<T>(encoder: T) -> Self
where T: EncoderToImpl + 'a,

Source

pub fn get_channels(&self) -> u16

Source

pub fn get_max_channels(&self) -> u16

Source

pub fn begin_encoding(&mut self) -> Result<(), AudioWriteError>

Source

pub fn new_fmt_chunk(&mut self) -> Result<FmtChunk, AudioWriteError>

Source

pub fn get_bitrate(&self) -> u32

Source

pub fn update_fmt_chunk( &self, fmt: &mut FmtChunk, ) -> Result<(), AudioWriteError>

Source

pub fn finish(&mut self) -> Result<(), AudioWriteError>

Source

pub fn write_interleaved_samples<S>( &mut self, samples: &[S], ) -> Result<(), AudioWriteError>
where S: SampleType,

  • Write samples regardless of channels
Source

pub fn write_frame<S>(&mut self, frame: &[S]) -> Result<(), AudioWriteError>
where S: SampleType,

  • Write an audio frame, each frame contains one sample for all channels
Source

pub fn write_frames<S>( &mut self, frames: &[Vec<S>], ) -> Result<(), AudioWriteError>
where S: SampleType,

  • Write audio frames, each frame contains one sample for all channels
Source

pub fn write_sample<S>(&mut self, mono: S) -> Result<(), AudioWriteError>
where S: SampleType,

  • Write only one sample regardless of channels
Source

pub fn write_mono<S>(&mut self, monos: S) -> Result<(), AudioWriteError>
where S: SampleType,

  • Write a single channel of audio to the encoder
Source

pub fn write_mono_channel<S>( &mut self, monos: &[S], ) -> Result<(), AudioWriteError>
where S: SampleType,

  • Write a single channel of audio to the encoder
Source

pub fn write_dual_mono<S>( &mut self, mono1: S, mono2: S, ) -> Result<(), AudioWriteError>
where S: SampleType,

  • Write double samples of audio to the encoder
Source

pub fn write_dual_monos<S>( &mut self, mono1: &[S], mono2: &[S], ) -> Result<(), AudioWriteError>
where S: SampleType,

  • Write double channels of audio to the encoder
Source

pub fn write_monos<S>( &mut self, monos: &[Vec<S>], ) -> Result<(), AudioWriteError>
where S: SampleType,

  • Write multiple channels of audio to the encoder
Source

pub fn write_stereo<S>(&mut self, stereo: (S, S)) -> Result<(), AudioWriteError>
where S: SampleType,

  • Write only one stereo sample to the encoder
Source

pub fn write_stereos<S>( &mut self, stereos: &[(S, S)], ) -> Result<(), AudioWriteError>
where S: SampleType,

  • Write stereo samples to the encoder

Trait Implementations§

Source§

impl<'a> Debug for Encoder<'a>

Source§

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

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

impl Default for Encoder<'_>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<'a> Freeze for Encoder<'a>

§

impl<'a> !RefUnwindSafe for Encoder<'a>

§

impl<'a> !Send for Encoder<'a>

§

impl<'a> !Sync for Encoder<'a>

§

impl<'a> Unpin for Encoder<'a>

§

impl<'a> !UnwindSafe for Encoder<'a>

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