pub struct DcBlocker { /* private fields */ }Expand description
Per-channel DC blocker using a 1-pole high-pass filter.
Default cutoff is 5 Hz — low enough to preserve all audible content while effectively removing DC offset from nonlinear processors.
Implementations§
Source§impl DcBlocker
impl DcBlocker
Sourcepub fn new(channels: usize, sample_rate: u32, cutoff_hz: f32) -> Self
pub fn new(channels: usize, sample_rate: u32, cutoff_hz: f32) -> Self
Create a new DC blocker.
cutoff_hz: Corner frequency (typically 3-10 Hz).
Sourcepub fn new_default(channels: usize, sample_rate: u32) -> Self
pub fn new_default(channels: usize, sample_rate: u32) -> Self
Create with default 5 Hz cutoff.
Sourcepub fn process_sample(&mut self, sample: f32, channel: usize) -> f32
pub fn process_sample(&mut self, sample: f32, channel: usize) -> f32
Process a single sample for one channel.
y[n] = x[n] - x[n-1] + R * y[n-1]
Sourcepub fn process_block_interleaved(
&mut self,
buffer: &mut [f32],
channels: usize,
num_frames: usize,
)
pub fn process_block_interleaved( &mut self, buffer: &mut [f32], channels: usize, num_frames: usize, )
Process a block of interleaved audio in-place.
buffer: Interleaved samples [ch0_f0, ch1_f0, ch0_f1, ch1_f1, ...]
channels: Number of interleaved channels.
num_frames: Number of frames (samples per channel).
Sourcepub fn set_sample_rate(&mut self, sample_rate: u32, cutoff_hz: f32)
pub fn set_sample_rate(&mut self, sample_rate: u32, cutoff_hz: f32)
Update sample rate (recalculates coefficient).
Sourcepub fn set_channels(&mut self, channels: usize)
pub fn set_channels(&mut self, channels: usize)
Update channel count (re-allocates state vectors).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DcBlocker
impl RefUnwindSafe for DcBlocker
impl Send for DcBlocker
impl Sync for DcBlocker
impl Unpin for DcBlocker
impl UnsafeUnpin for DcBlocker
impl UnwindSafe for DcBlocker
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.