[−][src]Struct codec2::Codec2
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,