From 02614e4a5ae51815960fa4ea9c966ceaae91905f Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 6 Feb 2022 19:20:03 +0100 Subject: [PATCH] Use absolute values for the peak meter gain I guess I wasn't thinking too clearly when I wrote this. --- plugins/examples/gain-gui/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/examples/gain-gui/src/lib.rs b/plugins/examples/gain-gui/src/lib.rs index 8ce09513..037091fe 100644 --- a/plugins/examples/gain-gui/src/lib.rs +++ b/plugins/examples/gain-gui/src/lib.rs @@ -178,7 +178,7 @@ impl Plugin for Gain { amplitude += *sample; } - amplitude /= num_samples as f32; + amplitude = (amplitude / num_samples as f32).abs(); let current_peak_meter = self.peak_meter.load(std::sync::atomic::Ordering::Relaxed); let new_peak_meter = if amplitude > current_peak_meter { amplitude