Skip to main content

AdpcmState

Struct AdpcmState 

Source
pub struct AdpcmState {
    pub channel_layout: Channels,
    pub frame_length: usize,
    pub channels: Vec<AdpcmChannelState>,
    pub frame_bytes: usize,
    pub header_bytes: usize,
    pub header_size: usize,
    pub encoding_type: SampleType,
    pub sample_rate: u32,
    pub current_header: Option<Vec<u8>>,
    pub low_nibble: bool,
    pub pending_byte: u8,
    pub current_channel: usize,
}
Expand description

Manages the state for ADPCM and PCM encoding/decoding within a stream.

This state handles the framing, headers, and adaptive predictor values for ADPCM. Although it is named AdpcmState, it supports all formats defined in SampleType, including 8-bit and 16-bit PCM.

Fields§

§channel_layout: Channels§frame_length: usize§channels: Vec<AdpcmChannelState>§frame_bytes: usize§header_bytes: usize§header_size: usize§encoding_type: SampleType§sample_rate: u32§current_header: Option<Vec<u8>>§low_nibble: bool§pending_byte: u8§current_channel: usize

Implementations§

Source§

impl AdpcmState

Source

pub fn new(channel_layout: Channels, frame_length: usize) -> Self

Source

pub fn with_type( channel_layout: Channels, frame_length: usize, encoding_type: SampleType, sample_rate: u32, ) -> Self

Source

pub fn get_header_size(channel_layout: Channels) -> usize

Source

pub fn encode(&mut self, input: &[i16], output: &mut [u8]) -> (usize, usize)

Source

pub fn decode( &mut self, input: &[u8], output: &mut [i16], ) -> Result<(usize, usize), AdpcmError>

Auto Trait Implementations§

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.