Skip to main content

DelayLine

Struct DelayLine 

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

Delay Line

A multi-sample delay line with feedback and wet/dry mix. Supports CV-controlled delay time for effects like chorus and flanging.

The default maximum delay time is 2 seconds at any sample rate; a longer buffer can be requested with DelayLine::with_max_delay. Two opt-in modes cover tape-echo territory: DelayLine::with_unclamped_feedback permits feedback at and past unity (self-oscillation) with tape-style saturation in the recirculation path, and DelayLine::with_linear_time reinterprets the time input as seconds directly instead of the exponential CV map. DelayLine::tape combines all three.

Implementations§

Source§

impl DelayLine

Source

pub fn new(sample_rate: f64) -> Self

Source

pub fn with_max_delay(sample_rate: f64, max_delay_secs: f64) -> Self

A delay line whose buffer holds up to max_delay_secs of signal.

DelayLine::new delegates here with the 2 s default, so existing patches are unaffected. The exponential time map spans 1 ms..max_delay_secs for whatever maximum is chosen.

Source

pub fn with_unclamped_feedback(self) -> Self

Opt in to feedback at and past unity (up to 1.5), with tape-style saturation applied to the recirculated sample so past-unity feedback compresses into mud instead of growing without bound. Hardware delays self-oscillate; with this flag, so does this one. Non-finite input is already sanitised before it can enter the buffer, so a NaN cannot latch.

Source

pub fn with_linear_time(self) -> Self

Opt in to a linear time input: the time port takes seconds directly (clamped to 0..max_delay_secs) instead of the exponential 1 ms · (max_ms)^cv map. The 5 ms read-distance slew still applies, so delay-time changes glide in pitch exactly as in the default mode.

Source

pub fn tape(sample_rate: f64) -> Self

Tape-echo preset: 12 s maximum delay, linear-seconds time input, and unclamped feedback with saturation in the loop. Registered in the module registry as "tape_delay".

Trait Implementations§

Source§

impl Default for DelayLine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl GraphModule for DelayLine

Source§

fn port_spec(&self) -> &PortSpec

Returns the module’s port specification
Source§

fn tick(&mut self, inputs: &PortValues, outputs: &mut PortValues)

Process one sample given port values
Source§

fn reset(&mut self)

Reset internal state
Source§

fn set_sample_rate(&mut self, sample_rate: f64)

Set sample rate
Source§

fn breaks_feedback_cycle(&self) -> bool

Whether this module breaks a feedback cycle in the patch graph. Read more
Source§

fn type_id(&self) -> &'static str

Get module type identifier for serialization
Source§

fn tick_masked( &mut self, inputs: &PortValues, outputs: &mut PortValues, wanted: u32, )

Process one sample, told which outputs anyone will actually read. Read more
Source§

fn process_block( &mut self, inputs: &BlockPortValues, outputs: &mut BlockPortValues, frames: usize, )

Process a block of samples (optional optimization). Read more
Source§

fn params(&self) -> &[ParamDef]

Get parameter definitions for UI binding. Read more
Source§

fn get_param(&self, _id: ParamId) -> Option<f64>

Get a parameter value. Read more
Source§

fn set_param(&mut self, _id: ParamId, _value: f64)

Set a parameter value. Read more
Source§

fn serialize_state(&self) -> Option<Value>

Available on crate feature alloc only.
Serialize module state (alloc feature only)
Source§

fn deserialize_state(&mut self, _state: &Value) -> Result<(), String>

Available on crate feature alloc only.
Deserialize module state (alloc feature only)
Source§

fn introspect(&self) -> Option<&dyn ModuleIntrospection>

Available on crate feature alloc only.
Downcast this module to its ModuleIntrospection view, if it exposes one. Read more
Source§

fn introspect_mut(&mut self) -> Option<&mut dyn ModuleIntrospection>

Available on crate feature alloc only.
Mutable companion to introspect, used to set internal parameters.
Source§

impl ModuleIntrospection for DelayLine

Available on crate feature alloc only.
Source§

fn param_infos(&self) -> Vec<ParamInfo>

Get all parameter descriptors for this module Read more
Source§

fn get_param_info(&self, id: &str) -> Option<ParamInfo>

Get a specific parameter by its ID
Source§

fn set_param_by_id(&mut self, _id: &str, _value: f64) -> bool

Set a parameter value by its ID Read more

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.