1
0
Fork 0

Fix copying tail to playback buffer

I noticed the effect wasn't deterministic, when I saw this. Oops.
This commit is contained in:
Robbert van der Helm 2022-11-09 19:46:42 +01:00
parent 333ff2c05e
commit e6c43e35d3

View file

@ -118,8 +118,9 @@ impl RingBuffer {
let copy_num_from_end = note_period_samples - copy_num_from_start;
playback_buffer[0..copy_num_from_end]
.copy_from_slice(&recording_buffer[recording_buffer.len() - copy_num_from_end..]);
playback_buffer[copy_num_from_end..]
.copy_from_slice(&recording_buffer[..copy_num_from_start]);
playback_buffer[copy_num_from_end..].copy_from_slice(
&recording_buffer[self.next_write_pos - copy_num_from_start..self.next_write_pos],
);
}
// The playback buffer is normalized as necessary. This prevents small grains from being