removed DC blocker from delay, was a bad idea if you want to delay CV....
This commit is contained in:
parent
8995541fda
commit
63644b00da
2 changed files with 9 additions and 15 deletions
|
@ -571,7 +571,7 @@ impl DelayBuffer {
|
||||||
pub struct DCBlockFilter {
|
pub struct DCBlockFilter {
|
||||||
xm1: f64,
|
xm1: f64,
|
||||||
ym1: f64,
|
ym1: f64,
|
||||||
R: f64,
|
r: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DCBlockFilter {
|
impl DCBlockFilter {
|
||||||
|
@ -579,7 +579,7 @@ impl DCBlockFilter {
|
||||||
Self {
|
Self {
|
||||||
xm1: 0.0,
|
xm1: 0.0,
|
||||||
ym1: 0.0,
|
ym1: 0.0,
|
||||||
R: 0.995,
|
r: 0.995,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,16 +589,16 @@ impl DCBlockFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_sample_rate(&mut self, srate: f32) {
|
pub fn set_sample_rate(&mut self, srate: f32) {
|
||||||
self.R = 0.995;
|
self.r = 0.995;
|
||||||
if srate > 90000.0 {
|
if srate > 90000.0 {
|
||||||
self.R = 0.9965;
|
self.r = 0.9965;
|
||||||
} else if srate > 120000.0 {
|
} else if srate > 120000.0 {
|
||||||
self.R = 0.997;
|
self.r = 0.997;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn next(&mut self, input: f32) -> f32 {
|
pub fn next(&mut self, input: f32) -> f32 {
|
||||||
let y = input as f64 - self.xm1 + self.R * self.ym1;
|
let y = input as f64 - self.xm1 + self.r * self.ym1;
|
||||||
self.xm1 = input as f64;
|
self.xm1 = input as f64;
|
||||||
self.ym1 = y;
|
self.ym1 = y;
|
||||||
y as f32
|
y as f32
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use crate::nodes::{NodeAudioContext, NodeExecContext};
|
use crate::nodes::{NodeAudioContext, NodeExecContext};
|
||||||
use crate::dsp::{NodeId, SAtom, ProcBuf, DspNode, LedPhaseVals};
|
use crate::dsp::{NodeId, SAtom, ProcBuf, DspNode, LedPhaseVals};
|
||||||
use crate::dsp::helpers::{DelayBuffer, crossfade, DCBlockFilter};
|
use crate::dsp::helpers::{DelayBuffer, crossfade};
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! fa_dly_s { ($formatter: expr, $v: expr, $denorm_v: expr) => { {
|
macro_rules! fa_dly_s { ($formatter: expr, $v: expr, $denorm_v: expr) => { {
|
||||||
|
@ -31,7 +31,6 @@ macro_rules! fa_dly_s { ($formatter: expr, $v: expr, $denorm_v: expr) => { {
|
||||||
pub struct Delay {
|
pub struct Delay {
|
||||||
buffer: Box<DelayBuffer>,
|
buffer: Box<DelayBuffer>,
|
||||||
fb_sample: f32,
|
fb_sample: f32,
|
||||||
dcblock: DCBlockFilter,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Delay {
|
impl Delay {
|
||||||
|
@ -39,7 +38,6 @@ impl Delay {
|
||||||
Self {
|
Self {
|
||||||
buffer: Box::new(DelayBuffer::new()),
|
buffer: Box::new(DelayBuffer::new()),
|
||||||
fb_sample: 0.0,
|
fb_sample: 0.0,
|
||||||
dcblock: DCBlockFilter::new(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,12 +82,10 @@ impl DspNode for Delay {
|
||||||
|
|
||||||
fn set_sample_rate(&mut self, srate: f32) {
|
fn set_sample_rate(&mut self, srate: f32) {
|
||||||
self.buffer.set_sample_rate(srate);
|
self.buffer.set_sample_rate(srate);
|
||||||
self.dcblock.set_sample_rate(srate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self) {
|
fn reset(&mut self) {
|
||||||
self.buffer.reset();
|
self.buffer.reset();
|
||||||
self.dcblock.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -101,7 +97,6 @@ impl DspNode for Delay {
|
||||||
use crate::dsp::{out, inp, denorm};
|
use crate::dsp::{out, inp, denorm};
|
||||||
|
|
||||||
let buffer = &mut *self.buffer;
|
let buffer = &mut *self.buffer;
|
||||||
let dcblock = &mut self.dcblock;
|
|
||||||
|
|
||||||
let inp = inp::Delay::inp(inputs);
|
let inp = inp::Delay::inp(inputs);
|
||||||
let time = inp::Delay::time(inputs);
|
let time = inp::Delay::time(inputs);
|
||||||
|
@ -121,9 +116,8 @@ impl DspNode for Delay {
|
||||||
denorm::Delay::time(time, frame));
|
denorm::Delay::time(time, frame));
|
||||||
|
|
||||||
out.write(frame,
|
out.write(frame,
|
||||||
dcblock.next(
|
|
||||||
crossfade(dry, out_sample,
|
crossfade(dry, out_sample,
|
||||||
denorm::Delay::mix(mix, frame).clamp(0.0, 1.0))));
|
denorm::Delay::mix(mix, frame).clamp(0.0, 1.0)));
|
||||||
|
|
||||||
fb_s = out_sample;
|
fb_s = out_sample;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue