Fixed more bugs in the Dattorro reverb (delay time interpretation in DelayBuffer)
This commit is contained in:
parent
c57274bfe4
commit
525c8d8c1b
2 changed files with 29 additions and 10 deletions
|
@ -102,6 +102,8 @@ pub struct DattorroReverb {
|
||||||
|
|
||||||
left_sum: f32,
|
left_sum: f32,
|
||||||
right_sum: f32,
|
right_sum: f32,
|
||||||
|
|
||||||
|
dbg_count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait DattorroReverbParams {
|
pub trait DattorroReverbParams {
|
||||||
|
@ -158,6 +160,8 @@ impl DattorroReverb {
|
||||||
|
|
||||||
left_sum: 0.0,
|
left_sum: 0.0,
|
||||||
right_sum: 0.0,
|
right_sum: 0.0,
|
||||||
|
|
||||||
|
dbg_count: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.reset();
|
this.reset();
|
||||||
|
@ -403,6 +407,19 @@ impl DattorroReverb {
|
||||||
let left = self.apf2[0].0.next(left_apf2_delay_ms, self.apf2[0].2, left);
|
let left = self.apf2[0].0.next(left_apf2_delay_ms, self.apf2[0].2, left);
|
||||||
let left = self.delay2[0].0.next_cubic(self.delay2[0].1, left);
|
let left = self.delay2[0].0.next_cubic(self.delay2[0].1, left);
|
||||||
|
|
||||||
|
if self.dbg_count % 48 == 0 {
|
||||||
|
println!("APFS dcy={:8.6}; {:8.6} {:8.6} {:8.6} {:8.6}",
|
||||||
|
decay,
|
||||||
|
left_apf1_delay_ms, right_apf1_delay_ms,
|
||||||
|
left_apf2_delay_ms, right_apf2_delay_ms);
|
||||||
|
println!("DELY1/2 {:8.6} / {:8.6} | {:8.6} / {:8.6}",
|
||||||
|
self.delay1[0].1,
|
||||||
|
self.delay2[0].1,
|
||||||
|
self.delay1[1].1,
|
||||||
|
self.delay2[1].1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Right Sum => APF1 => Delay1 => LPF => HPF => APF2 => Delay2
|
// Right Sum => APF1 => Delay1 => LPF => HPF => APF2 => Delay2
|
||||||
// And then send this over to the left sum.
|
// And then send this over to the left sum.
|
||||||
let right = self.right_sum;
|
let right = self.right_sum;
|
||||||
|
@ -439,6 +456,8 @@ impl DattorroReverb {
|
||||||
let left_out = self.out_dc_block[0].next(left_accum);
|
let left_out = self.out_dc_block[0].next(left_accum);
|
||||||
let right_out = self.out_dc_block[1].next(right_accum);
|
let right_out = self.out_dc_block[1].next(right_accum);
|
||||||
|
|
||||||
|
self.dbg_count += 1;
|
||||||
|
|
||||||
// (left_out * 0.5, right_out * 0.5)
|
// (left_out * 0.5, right_out * 0.5)
|
||||||
(left_out * 0.5, right_out * 0.5)
|
(left_out * 0.5, right_out * 0.5)
|
||||||
}
|
}
|
||||||
|
|
|
@ -821,9 +821,9 @@ impl DelayBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn nearest_at(&self, delay_time: f32) -> f32 {
|
pub fn nearest_at(&self, delay_time_ms: f32) -> f32 {
|
||||||
let len = self.data.len();
|
let len = self.data.len();
|
||||||
let offs = (delay_time * self.srate).floor() as usize % len;
|
let offs = ((delay_time_ms * self.srate) / 1000.0).floor() as usize % len;
|
||||||
let idx = ((self.wr + len) - offs) % len;
|
let idx = ((self.wr + len) - offs) % len;
|
||||||
self.data[idx]
|
self.data[idx]
|
||||||
}
|
}
|
||||||
|
@ -860,13 +860,13 @@ impl AllPass {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn delay_tap_n(&self, time: f32) -> f32 {
|
pub fn delay_tap_n(&self, time_ms: f32) -> f32 {
|
||||||
self.delay.tap_n(time)
|
self.delay.tap_n(time_ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn next(&mut self, time: f32, g: f32, v: f32) -> f32 {
|
pub fn next(&mut self, time_ms: f32, g: f32, v: f32) -> f32 {
|
||||||
let s = self.delay.cubic_interpolate_at(time);
|
let s = self.delay.linear_interpolate_at(time_ms);
|
||||||
let input = v + -g * s;
|
let input = v + -g * s;
|
||||||
self.delay.feed(input);
|
self.delay.feed(input);
|
||||||
input * g + s
|
input * g + s
|
||||||
|
@ -894,13 +894,13 @@ impl Comb {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn delay_tap_c(&self, time: f32) -> f32 {
|
pub fn delay_tap_c(&self, time_ms: f32) -> f32 {
|
||||||
self.delay.tap_c(time)
|
self.delay.tap_c(time_ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn delay_tap_n(&self, time: f32) -> f32 {
|
pub fn delay_tap_n(&self, time_ms: f32) -> f32 {
|
||||||
self.delay.tap_n(time)
|
self.delay.tap_n(time_ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Reference in a new issue