Skip to main content

InterpolatedReader

Struct InterpolatedReader 

Source
pub struct InterpolatedReader<T> { /* private fields */ }
Expand description

Heap-allocated buffer reader with fractional-position interpolation.

When wrap is true the position wraps modulo len (periodic / wavetable mode). When wrap is false the position clamps at buffer boundaries (sample mode).

Implementations§

Source§

impl<T: Transcendental + Copy> InterpolatedReader<T>

Source

pub fn new(buffer: Vec<T>) -> Self

Source

pub fn from_boxed(buffer: Box<[T]>) -> Self

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn position(&self) -> f64

Source

pub fn set_position(&mut self, pos: f64)

Source

pub fn rate(&self) -> f64

Source

pub fn set_rate(&mut self, rate: f64)

Source

pub fn is_cubic(&self) -> bool

Source

pub fn set_cubic(&mut self, cubic: bool)

Source

pub fn is_wrap(&self) -> bool

Source

pub fn set_wrap(&mut self, wrap: bool)

Source

pub fn set_buffer(&mut self, buffer: Vec<T>)

Source

pub fn as_slice(&self) -> &[T]

Source

pub fn read_one(&self) -> T

Read a single sample at the current position without advancing.

Source

pub fn advance(&mut self)

Advance position by self.rate (one sample).

Source

pub fn render_block(&mut self, output: &mut [T])

Read the next block of samples, advancing self.position.

Auto Trait Implementations§

§

impl<T> Freeze for InterpolatedReader<T>

§

impl<T> RefUnwindSafe for InterpolatedReader<T>
where T: RefUnwindSafe,

§

impl<T> Send for InterpolatedReader<T>
where T: Send,

§

impl<T> Sync for InterpolatedReader<T>
where T: Sync,

§

impl<T> Unpin for InterpolatedReader<T>

§

impl<T> UnsafeUnpin for InterpolatedReader<T>

§

impl<T> UnwindSafe for InterpolatedReader<T>
where T: UnwindSafe,

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> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to &dyn std::any::Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert to &mut dyn std::any::Any
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.