[][src]Struct codec2::Codec2

pub struct Codec2 { /* fields omitted */ }

A Codec2 object for encoding or decoding audio

Implementations

impl Codec2[src]

pub fn new(mode: Codec2Mode) -> Self[src]

Creates a new Codec2 object suitable for encoding or decoding audio

pub fn bits_per_frame(&self) -> usize[src]

The number of bits in an encoded (compressed) frame; 64 for the 3200 bitrate, 48 for 2400.

pub fn samples_per_frame(&self) -> usize[src]

How many samples an encoded (compressed) frame represents; generally 160 (20ms of speech).

pub fn encode(&mut self, bits: &mut [u8], speech: &[i16])[src]

Encodes speech samples at current bitrate into bits_per_frame()/8 rounded up output bytes. For MODE_3200, this is 64 bits or 8 bytes, for MODE_2400, it's 48 bits (6 bytes).

pub fn decode(&mut self, speech: &mut [i16], bits: &[u8])[src]

Decodes bits_per_frame() compressed bits into samples_per_frame() speech samples. For MODE_3200, the input is 64 bits or 8 bytes, for MODE_2400, it's 48 bits (6 bytes).

Trait Implementations

impl Clone for Codec2[src]

impl Debug for Codec2[src]

Auto Trait Implementations

impl RefUnwindSafe for Codec2

impl Send for Codec2

impl Sync for Codec2

impl Unpin for Codec2

impl UnwindSafe for Codec2

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.