From f625bb579f34250a237e0ca9cfdc6f60bb7c5469 Mon Sep 17 00:00:00 2001 From: pkv Date: Mon, 23 Jan 2023 14:30:38 +0100 Subject: [PATCH] obs-filters: Fix expander and upward compressor above threshold Fixes behaviours above threshold for expander and upward compressor. Fixes issues #8052 & #8030 . Signed-off-by: pkv --- plugins/obs-filters/expander-filter.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/plugins/obs-filters/expander-filter.c b/plugins/obs-filters/expander-filter.c index 157cf5640..aef9a9972 100644 --- a/plugins/obs-filters/expander-filter.c +++ b/plugins/obs-filters/expander-filter.c @@ -379,14 +379,11 @@ static inline void process_sample(size_t idx, float *samples, float *env_buf, /* --------------------------------- */ /* output */ - float min_val = - is_upwcomp ? fminf(diff, threshold - mul_to_db(samples[idx])) - : 0.0f; - gain = db_to_mul(fminf(min_val, gain_db[idx])); - - // above threshold, don't process expander nor upward compressor - if (threshold - env_db <= 0) - gain = 1.0f; + if (!is_upwcomp) { + gain = db_to_mul(fminf(0, gain_db[idx])); + } else { + gain = db_to_mul(gain_db[idx]); + } samples[idx] *= gain * output_gain; }