diff --git a/src/util/stft.rs b/src/util/stft.rs index f572fc48..3662a9f4 100644 --- a/src/util/stft.rs +++ b/src/util/stft.rs @@ -205,6 +205,9 @@ impl StftHelper { } } + already_processed_samples += samples_to_process; + self.current_pos = (self.current_pos + samples_to_process) % block_size; + // At this point we either have `already_processed_samples == main_buffer_len`, or // `self.current_pos % window_interval == 0`. If it's the latter, then we can process a // new block. @@ -253,10 +256,6 @@ impl StftHelper { ); } } - - // Do this after handling the block or else we'll copy the wrong samples. - already_processed_samples += samples_to_process; - self.current_pos = (self.current_pos + samples_to_process) % block_size; } } }