mirror of
https://github.com/robbert-vdh/nih-plug.git
synced 2026-07-01 02:36:54 +00:00
Don't do gain compensation in STFT helper
You'll likely want to add some scaling yourself anyways, so this would just be a wasted operation since the scaling also depends on your window function.
This commit is contained in:
@@ -72,18 +72,18 @@ impl Plugin for Stft {
|
||||
buffer: &mut Buffer,
|
||||
_context: &mut impl ProcessContext,
|
||||
) -> ProcessStatus {
|
||||
const GAIN_COMPENSATION: f32 = 2.0 / OVERLAP_TIMES as f32;
|
||||
self.stft.process_overlap_add(
|
||||
buffer,
|
||||
[],
|
||||
&self.window_function,
|
||||
OVERLAP_TIMES,
|
||||
2.0 / OVERLAP_TIMES as f32, // Gain compensation for the overlap
|
||||
|_channel_idx, _, _block| {
|
||||
// for sample in block {
|
||||
// // TODO: Use the FFTW bindings and do some STFT operation here instead of
|
||||
// // reducing the gain at a 2048 sample latency...
|
||||
// *sample *= 0.5;
|
||||
// }
|
||||
|_channel_idx, _, block| {
|
||||
for sample in block {
|
||||
// TODO: Use the FFTW bindings and do some STFT operation here instead of
|
||||
// reducing the gain at a 2048 sample latency...
|
||||
*sample *= GAIN_COMPENSATION;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user