Skip to content

Commit 96d21f9

Browse files
committed
Fix bug when overlap_size = 0.
1 parent 9fbb39d commit 96d21f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

shared-module/audiodelays/PitchShift.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ audioio_get_buffer_result_t audiodelays_pitch_shift_get_buffer(audiodelays_pitch
270270
}
271271
}
272272

273-
if (self->overlap_len) {
273+
if (overlap_size) {
274274
// Copy last sample from overlap and store in buffer
275275
window_buffer[self->window_index + window_size * buf_offset] = overlap_buffer[self->overlap_index + overlap_size * buf_offset];
276276

@@ -289,7 +289,7 @@ audioio_get_buffer_result_t audiodelays_pitch_shift_get_buffer(audiodelays_pitch
289289
int32_t word = (int32_t)window_buffer[read_index + window_size * buf_offset];
290290

291291
// Check if we're within the overlap range and mix buffer sample with overlap sample
292-
if (read_overlap_offset > 0 && read_overlap_offset <= overlap_size) {
292+
if (overlap_size && read_overlap_offset > 0 && read_overlap_offset <= overlap_size) {
293293
// Apply volume based on overlap position to buffer sample
294294
word *= (int32_t)read_overlap_offset;
295295

0 commit comments

Comments
 (0)