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>
impl<T: Transcendental + Copy> InterpolatedReader<T>
Sourcepub fn new(buffer: Vec<T>) -> Self
pub fn new(buffer: Vec<T>) -> Self
Create a new reader from a Vec<T>.
The reader starts at position 0 with unit rate and linear interpolation.
Sourcepub fn from_boxed(buffer: Box<[T]>) -> Self
pub fn from_boxed(buffer: Box<[T]>) -> Self
Create a new reader from a pre-allocated Box<[T]>.
Sourcepub fn set_position(&mut self, pos: f64)
pub fn set_position(&mut self, pos: f64)
Set the read position (in samples).
Sourcepub fn set_cubic(&mut self, cubic: bool)
pub fn set_cubic(&mut self, cubic: bool)
Enable (true) or disable (false) cubic Hermite interpolation.
Sourcepub fn set_wrap(&mut self, wrap: bool)
pub fn set_wrap(&mut self, wrap: bool)
Enable (true) or disable (false) wrap mode (periodic / wavetable).
Sourcepub fn set_buffer(&mut self, buffer: Vec<T>)
pub fn set_buffer(&mut self, buffer: Vec<T>)
Replace the internal buffer and reset the position to 0.
Sourcepub fn render_block(&mut self, output: &mut [T])
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> 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