Skip to main content

Drift

Struct Drift 

Source
pub struct Drift { /* private fields */ }
Expand description

Resamples interleaved frames from one clock to another close to it, by cubic interpolation between the input frames, at a ratio steered from the buffer’s fill after each of the device’s chunks.

Implementations§

Source§

impl Drift

Source

pub fn new(channels: u16, side: DeviceSide, nominal: f64) -> Self

Source

pub fn ratio(&self) -> f64

Input frames for each output frame now.

Source

pub fn device_ppm(&self) -> i32

How far the device’s clock runs from the stream’s, in parts per million, as the ratio follows it.

Source

pub fn steer(&mut self, buffer: &FrameBuffer)

Steers the ratio from the fill after the device’s last chunk, once for each chunk: a fuller buffer than kept takes more input frames for each output frame, whichever side the device is on.

Source

pub fn wanted(&self, frames: usize) -> usize

The input frames to add before frames output frames can be made.

Source

pub fn push(&mut self, input: &[f32])

Source

pub fn make(&mut self, out: &mut Vec<f32>, most: usize)

Makes output frames while there are input frames enough, into out, up to most of them.

Auto Trait Implementations§

§

impl Forget for Drift

§

impl Freeze for Drift

§

impl Move for Drift

§

impl RefUnwindSafe for Drift

§

impl Send for Drift

§

impl Sync for Drift

§

impl Unpin for Drift

§

impl UnsafeUnpin for Drift

§

impl UnwindSafe for Drift

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.