From 9bd229e11ba803ab3c5e0ecd73d65ad6e06654a6 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Fri, 18 Apr 2025 22:48:34 +0200 Subject: [PATCH] fix --- lib/bs412.c | 18 +++++++++--------- src/fm95.c | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/bs412.c b/lib/bs412.c index b25c3d3..5f3d72a 100644 --- a/lib/bs412.c +++ b/lib/bs412.c @@ -15,16 +15,16 @@ void init_modulation_power_measure(MPXPowerMeasurement* mpx, int sample_rate) { } float measure_mpx(MPXPowerMeasurement* mpx, float deviation) { - mpx->sample += deviation * deviation; // rmS - mpx->i++; + mpx->sample += deviation * deviation; // rmS + mpx->i++; - float avg_deviation = sqrtf(mpx->sample / mpx->i); // RMs - float modulation_power = deviation_to_dbr(avg_deviation); + float avg_deviation = sqrtf(mpx->sample / mpx->i); // RMs + float modulation_power = deviation_to_dbr(avg_deviation); - if (mpx->i >= mpx->sample_rate * 60) { - mpx->sample = 0; - mpx->i = 0; - } + if (mpx->i >= mpx->sample_rate * 60) { + mpx->sample = 0; + mpx->i = 0; + } - return modulation_power; + return modulation_power; } diff --git a/src/fm95.c b/src/fm95.c index c45c53b..16ad482 100644 --- a/src/fm95.c +++ b/src/fm95.c @@ -451,8 +451,8 @@ int main(int argc, char **argv) { MPXPowerMeasurement power; init_modulation_power_measure(&power, sample_rate); - MPXPowerMeasurement mpx_only_power; - init_modulation_power_measure(&mpx_only_power, sample_rate); + MPXPowerMeasurement mpx_only_power; + init_modulation_power_measure(&mpx_only_power, sample_rate); signal(SIGINT, stop); signal(SIGTERM, stop); @@ -542,10 +542,10 @@ int main(int argc, char **argv) { if(mpx_on) mpx += hard_clip(current_mpx_in, MPX_CLIPPER_THRESHOLD)*MPX_VOLUME; if(sca_on) mpx += modulate_fm(&sca_mod, hard_clip(current_sca_in, sca_clipper_threshold))*SCA_VOLUME; - float mpx_only = measure_mpx(&mpx_only_power, mpx * mpx_deviation); + float mpx_only = measure_mpx(&mpx_only_power, mpx * mpx_deviation); float mpower = measure_mpx(&power, (audio+mpx) * mpx_deviation); if (mpower > mpx_power) { - float excess_power = mpower - mpx_power - mpx_only_power; + float excess_power = mpower - mpx_power - mpx_only; audio *= (dbr_to_deviation(-excess_power)/mpx_deviation); }