XboxADPCMEncoder

Struct XboxADPCMEncoder 

Source
pub struct XboxADPCMEncoder<'a, E> { /* private fields */ }
Expand description

XboxADPCM encoder implementation.

Implementations§

Source§

impl<'a, E> XboxADPCMEncoder<'a, E>
where E: Sized,

Source

pub fn new( num_channels: usize, lookahead: u8, sink: &'a mut dyn XboxADPCMEncodeSink<Error = E>, ) -> XboxADPCMEncoder<'a, E>

Initialize an encoder with the given channel count, and lookahead for the given sink.

Higher lookahead may slightly reduce noise, but it will also exponentially increase encoding time.

§Panics

Panics if num_channels is not between 1 and 8

Source

pub fn encode<B: AsRef<[C]>, C: AsRef<[i16]>>( &mut self, input: B, ) -> Result<(), E>

Encode with the given samples using some samples.

Note that this may not always encode all samples passed and may store some in a buffer. To flush the buffer, run XboxADPCMEncoder::finish.

§Panics

Panics if the input has the wrong number of channels or the samples are wrong.

Source

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

Finish encoding and then resets the encoder.

This will encode all remaining samples, filling any unused samples with silence. If a simple reset is desired without any further writes, call XboxADPCMEncoder::reset instead.

Source

pub fn reset(&mut self)

Reset the encoder immediately without writing any more samples.

Any samples yet to be encoded will be dropped. If this is not desired, call XboxADPCMEncoder::finish instead.

Auto Trait Implementations§

§

impl<'a, E> Freeze for XboxADPCMEncoder<'a, E>

§

impl<'a, E> !RefUnwindSafe for XboxADPCMEncoder<'a, E>

§

impl<'a, E> !Send for XboxADPCMEncoder<'a, E>

§

impl<'a, E> !Sync for XboxADPCMEncoder<'a, E>

§

impl<'a, E> Unpin for XboxADPCMEncoder<'a, E>

§

impl<'a, E> !UnwindSafe for XboxADPCMEncoder<'a, E>

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.