pub struct Limiter<T: Transcendental, const BUF_SIZE: usize> { /* private fields */ }Expand description
Limiter with lookahead using Delay + envelope detection
Implementations§
Source§impl<T: Transcendental, const BUF_SIZE: usize> Limiter<T, BUF_SIZE>
impl<T: Transcendental, const BUF_SIZE: usize> Limiter<T, BUF_SIZE>
Sourcepub fn new(
sample_rate: f32,
threshold_db: f32,
attack: f32,
release: f32,
output_gain: f32,
) -> Self
pub fn new( sample_rate: f32, threshold_db: f32, attack: f32, release: f32, output_gain: f32, ) -> Self
Create a new limiter
Sourcepub fn process_sample(&mut self, input: T) -> T
pub fn process_sample(&mut self, input: T) -> T
Process a single sample
Sourcepub fn process_block(&mut self, input: &[T], output: &mut [T])
pub fn process_block(&mut self, input: &[T], output: &mut [T])
Process a block of samples
Sourcepub fn current_gain(&self) -> f32
pub fn current_gain(&self) -> f32
Get current gain reduction
Sourcepub fn lookahead_samples(&self) -> usize
pub fn lookahead_samples(&self) -> usize
Get lookahead samples count
Sourcepub fn set_threshold(&mut self, db: f32)
pub fn set_threshold(&mut self, db: f32)
Set threshold in dB
Sourcepub fn set_attack(&mut self, attack: f32)
pub fn set_attack(&mut self, attack: f32)
Set attack time
Sourcepub fn set_release(&mut self, release: f32)
pub fn set_release(&mut self, release: f32)
Set release time
Sourcepub fn set_lookahead(&mut self, lookahead: f32)
pub fn set_lookahead(&mut self, lookahead: f32)
Set lookahead time
Sourcepub fn force_ready(&mut self)
pub fn force_ready(&mut self)
Force finish initialization and warmup (for tests)
Trait Implementations§
Source§impl<T: Transcendental, const BUF_SIZE: usize> Node<T, BUF_SIZE> for Limiter<T, BUF_SIZE>
impl<T: Transcendental, const BUF_SIZE: usize> Node<T, BUF_SIZE> for Limiter<T, BUF_SIZE>
Source§fn node_type_id(&self) -> NodeTypeIdwhere
Self: 'static + Sized,
fn node_type_id(&self) -> NodeTypeIdwhere
Self: 'static + Sized,
Get the node’s type ID
Source§fn metadata(&self) -> NodeMetadata
fn metadata(&self) -> NodeMetadata
Get node metadata
Source§fn get_parameter(&self, id: &ParameterId) -> Option<ParamValue>
fn get_parameter(&self, id: &ParameterId) -> Option<ParamValue>
Get the value of a parameter
Source§fn set_parameter(
&mut self,
id: &ParameterId,
value: ParamValue,
) -> ProcessResult<()>
fn set_parameter( &mut self, id: &ParameterId, value: ParamValue, ) -> ProcessResult<()>
Set the value of a parameter
Source§fn input_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>
fn input_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>
Get mutable input port by index
Source§fn output_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>
fn output_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>
Get mutable output port by index
Source§fn control_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>
fn control_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>
Get mutable control port by index
Source§fn num_inputs(&self) -> usize
fn num_inputs(&self) -> usize
Total number of input ports
Source§fn num_outputs(&self) -> usize
fn num_outputs(&self) -> usize
Total number of output ports
Source§fn num_signal_inputs(&self) -> usize
fn num_signal_inputs(&self) -> usize
Number of signal input ports
Source§fn num_signal_outputs(&self) -> usize
fn num_signal_outputs(&self) -> usize
Number of signal output ports
Source§fn apply_set_parameter(
&mut self,
cmd: &SetParameter,
) -> Result<(), ProcessError>
fn apply_set_parameter( &mut self, cmd: &SetParameter, ) -> Result<(), ProcessError>
Apply a
SetParameter command to this node. Read moreSource§fn resolve_resources(&mut self, _resources: &mut ResourceRegistry<T>)
fn resolve_resources(&mut self, _resources: &mut ResourceRegistry<T>)
Resolve named shared resources (tape loops, etc.) from the registry,
acquiring the capability handle matching this node’s role.
Source§fn num_control_inputs(&self) -> usize
fn num_control_inputs(&self) -> usize
Number of control input ports
Source§fn num_control_outputs(&self) -> usize
fn num_control_outputs(&self) -> usize
Number of control output ports
Source§fn num_clock_inputs(&self) -> usize
fn num_clock_inputs(&self) -> usize
Number of clock input ports
Source§fn num_clock_outputs(&self) -> usize
fn num_clock_outputs(&self) -> usize
Number of clock output ports
Source§fn num_feedback_ports(&self) -> usize
fn num_feedback_ports(&self) -> usize
Number of feedback ports
Source§impl<T: Transcendental, const BUF_SIZE: usize> Processor<T, BUF_SIZE> for Limiter<T, BUF_SIZE>
impl<T: Transcendental, const BUF_SIZE: usize> Processor<T, BUF_SIZE> for Limiter<T, BUF_SIZE>
Source§fn process(
&mut self,
_ctx: &RenderContext,
_signal_inputs: &[&[T; BUF_SIZE]],
_control_inputs: &[T],
_clock_inputs: &[RenderContext],
_feedback_inputs: &[&[T; BUF_SIZE]],
) -> ProcessResult<()>
fn process( &mut self, _ctx: &RenderContext, _signal_inputs: &[&[T; BUF_SIZE]], _control_inputs: &[T], _clock_inputs: &[RenderContext], _feedback_inputs: &[&[T; BUF_SIZE]], ) -> ProcessResult<()>
Process a block of signal Read more
Auto Trait Implementations§
impl<T, const BUF_SIZE: usize> !Freeze for Limiter<T, BUF_SIZE>
impl<T, const BUF_SIZE: usize> !RefUnwindSafe for Limiter<T, BUF_SIZE>
impl<T, const BUF_SIZE: usize> !UnwindSafe for Limiter<T, BUF_SIZE>
impl<T, const BUF_SIZE: usize> Send for Limiter<T, BUF_SIZE>
impl<T, const BUF_SIZE: usize> Sync for Limiter<T, BUF_SIZE>
impl<T, const BUF_SIZE: usize> Unpin for Limiter<T, BUF_SIZE>where
T: Unpin,
impl<T, const BUF_SIZE: usize> UnsafeUnpin for Limiter<T, BUF_SIZE>where
T: UnsafeUnpin,
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