Struct Context

Source
pub struct Context { /* private fields */ }

Implementations§

Source§

impl Context

Source

pub fn get( src_format: Sample, src_channel_layout: ChannelLayout, src_rate: u32, dst_format: Sample, dst_channel_layout: ChannelLayout, dst_rate: u32, ) -> Result<Self, Error>

Create a resampler with the given definitions.

Source

pub fn get_with( src_format: Sample, src_channel_layout: ChannelLayout, src_rate: u32, dst_format: Sample, dst_channel_layout: ChannelLayout, dst_rate: u32, options: Dictionary<'_>, ) -> Result<Self, Error>

Create a resampler with the given definitions and custom options dictionary.

Source

pub fn input(&self) -> &Definition

Get the input definition.

Source

pub fn output(&self) -> &Definition

Get the output definition.

Source

pub fn delay(&self) -> Option<Delay>

Get the remaining delay.

Source

pub fn run( &mut self, input: &Audio, output: &mut Audio, ) -> Result<Option<Delay>, Error>

Run the resampler from the given input to the given output.

When there are internal frames to process it will return Ok(Some(Delay { .. })).

Source

pub fn flush(&mut self, output: &mut Audio) -> Result<Option<Delay>, Error>

Convert one of the remaining internal frames.

When there are no more internal frames Ok(None) will be returned.

Trait Implementations§

Source§

impl Drop for Context

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Context

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.