mirror of
https://github.com/robbert-vdh/nih-plug.git
synced 2026-07-01 02:36:54 +00:00
Add missing latency compensation in STFT example
The latency introduced by the linear phase filter wasn't compensated for.
This commit is contained in:
@@ -111,7 +111,10 @@ impl Plugin for Stft {
|
|||||||
_buffer_config: &BufferConfig,
|
_buffer_config: &BufferConfig,
|
||||||
context: &mut impl ProcessContext,
|
context: &mut impl ProcessContext,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
context.set_latency_samples(self.stft.latency_samples());
|
// The plugin's latency consists of the block size from the overlap-add procedure and half
|
||||||
|
// of the filter kernel's size (since we're using a linear phase/symmetrical convolution
|
||||||
|
// kernel)
|
||||||
|
context.set_latency_samples(self.stft.latency_samples() + (FILTER_WINDOW_SIZE as u32 / 2));
|
||||||
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user