From b51b66d0a1512a694ce9f5c936f6ff1edf1ee158 Mon Sep 17 00:00:00 2001 From: Kuba <132459354+KubaPro010@users.noreply.github.com> Date: Sat, 11 Oct 2025 10:44:03 +0200 Subject: [PATCH] clipper before --- src/fm95.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fm95.c b/src/fm95.c index 8689394..daeb839 100644 --- a/src/fm95.c +++ b/src/fm95.c @@ -214,6 +214,11 @@ int run_fm95(const FM95_Config config, FM95_Runtime* runtime) { r *= agc_gain; } + if (config.clipper_threshold != 0) { + l = hard_clip(l * config.audio_volume, config.clipper_threshold); + r = hard_clip(r * config.audio_volume, config.clipper_threshold); + } + float mod_l, mod_r; if(config.lpf_cutoff != 0) { @@ -226,11 +231,6 @@ int run_fm95(const FM95_Config config, FM95_Runtime* runtime) { mod_r = apply_preemphasis(&runtime->preemp_r, mod_r); } - if (config.clipper_threshold != 0) { - mod_l = hard_clip(mod_l * config.audio_volume, config.clipper_threshold); - mod_r = hard_clip(mod_r * config.audio_volume, config.clipper_threshold); - } - mpx = stereo_encode(&runtime->stencode, config.stereo, mod_l, mod_r); if(rds_on) {