Fix Buffr Glitch for crossfade lengths of 1 sample
This commit is contained in:
parent
9c48e7f59b
commit
32f981b1f6
|
@ -121,8 +121,10 @@ impl RingBuffer {
|
||||||
}
|
}
|
||||||
BufferStatus::Crossfading if self.next_sample_pos < self.crossfade_length => {
|
BufferStatus::Crossfading if self.next_sample_pos < self.crossfade_length => {
|
||||||
// This is an equal power fade between the part of the input after the first loop
|
// This is an equal power fade between the part of the input after the first loop
|
||||||
// and the buffer's existing contents.
|
// and the buffer's existing contents. The `.max(1)` is needed to avoid NaNs with
|
||||||
let crossfade_t = self.next_sample_pos as f32 / (self.crossfade_length - 1) as f32;
|
// crossfade lengths of 1 sample.
|
||||||
|
let crossfade_t =
|
||||||
|
self.next_sample_pos as f32 / (self.crossfade_length - 1).max(1) as f32;
|
||||||
let new_t = (1.0 - crossfade_t).sqrt();
|
let new_t = (1.0 - crossfade_t).sqrt();
|
||||||
let existing_t = crossfade_t.sqrt();
|
let existing_t = crossfade_t.sqrt();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue