pub struct AudioResampler { /* private fields */ }Implementations§
Source§impl AudioResampler
impl AudioResampler
Sourcepub fn new(
in_rate: u32,
out_rate: u32,
channels: u8,
chunk_size: usize,
) -> Result<Self, AudioError>
pub fn new( in_rate: u32, out_rate: u32, channels: u8, chunk_size: usize, ) -> Result<Self, AudioError>
Construct a resampler for in_rate → out_rate with
channels channels processing chunk_size input frames per
call. Returns an error if any rate is zero.
pub fn in_rate(&self) -> u32
pub fn out_rate(&self) -> u32
pub fn channels(&self) -> u8
pub fn chunk_size(&self) -> usize
Sourcepub fn process(
&mut self,
frame: &AudioFrame,
out: &mut Vec<f32>,
) -> Result<(), AudioError>
pub fn process( &mut self, frame: &AudioFrame, out: &mut Vec<f32>, ) -> Result<(), AudioError>
Process frame.samples (interleaved) and append output samples
(interleaved) into out. Carries any partial input chunk
internally for the next call.
The output PTS is the same as the input PTS — the resampler itself doesn’t expose its internal lookahead in our wire model (the encoder converts that into pre_skip ticks at the file header level).
Auto Trait Implementations§
impl !RefUnwindSafe for AudioResampler
impl !Sync for AudioResampler
impl !UnwindSafe for AudioResampler
impl Freeze for AudioResampler
impl Send for AudioResampler
impl Unpin for AudioResampler
impl UnsafeUnpin for AudioResampler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more