pub struct DelayLine<T, const MAX_DELAY: usize>where
T: Transcendental,{ /* private fields */ }Expand description
Delay line for audio effects — single-threaded circular buffer.
Provides a circular buffer for implementing delay, reverb, and other time-based effects.
§Thread safety
DelayLine is not thread-safe. It is designed for single-threaded
use inside the audio graph. Use PipeBuffer or
RingBuffer for cross-thread communication.
Implementations§
Source§impl<T, const MAX_DELAY: usize> DelayLine<T, MAX_DELAY>where
T: Transcendental,
impl<T, const MAX_DELAY: usize> DelayLine<T, MAX_DELAY>where
T: Transcendental,
Sourcepub fn set_delay_samples(&mut self, samples: usize)
pub fn set_delay_samples(&mut self, samples: usize)
Set the delay time in samples.
Sourcepub fn delay_samples(&self) -> usize
pub fn delay_samples(&self) -> usize
Current delay in samples.
Sourcepub fn sample_rate(&self) -> f32
pub fn sample_rate(&self) -> f32
The sample rate used for sec-to-sample conversion.
Sourcepub fn read_delayed(&self, delay: usize) -> T
pub fn read_delayed(&self, delay: usize) -> T
Read sample at arbitrary delay (0 = most recent).
Sourcepub fn read_interpolated(&self, delay_frac: f32) -> T
pub fn read_interpolated(&self, delay_frac: f32) -> T
Read with linear interpolation between samples.
Sourcepub fn write_position(&self) -> usize
pub fn write_position(&self) -> usize
Current write cursor position in the circular buffer.
Trait Implementations§
Source§impl<T, const MAX_DELAY: usize> Buffer<T> for DelayLine<T, MAX_DELAY>where
T: Transcendental,
impl<T, const MAX_DELAY: usize> Buffer<T> for DelayLine<T, MAX_DELAY>where
T: Transcendental,
Source§fn as_mut_slice(&mut self) -> &mut [T]
fn as_mut_slice(&mut self) -> &mut [T]
Mutable access to the buffer data.
Source§fn copy_from(&mut self, src: &[T])
fn copy_from(&mut self, src: &[T])
Copy data from a slice. Copies
min(src.len(), self.len()) samples.Source§fn stats(&self) -> BufferStats
fn stats(&self) -> BufferStats
Snapshot of performance statistics.
Source§fn reset_stats(&mut self)
fn reset_stats(&mut self)
Reset performance counters (not the data).
Auto Trait Implementations§
impl<T, const MAX_DELAY: usize> !Freeze for DelayLine<T, MAX_DELAY>
impl<T, const MAX_DELAY: usize> RefUnwindSafe for DelayLine<T, MAX_DELAY>where
T: RefUnwindSafe,
impl<T, const MAX_DELAY: usize> Send for DelayLine<T, MAX_DELAY>
impl<T, const MAX_DELAY: usize> Sync for DelayLine<T, MAX_DELAY>
impl<T, const MAX_DELAY: usize> Unpin for DelayLine<T, MAX_DELAY>where
T: Unpin,
impl<T, const MAX_DELAY: usize> UnsafeUnpin for DelayLine<T, MAX_DELAY>where
T: UnsafeUnpin,
impl<T, const MAX_DELAY: usize> UnwindSafe for DelayLine<T, MAX_DELAY>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