0
1
mirror of https://github.com/radio95-rnt/fm95.git synced 2026-02-26 19:23:51 +01:00

fix the peak power limiter

This commit is contained in:
2025-05-31 11:19:54 +02:00
parent b301577227
commit 4a0eddbbde

View File

@@ -579,8 +579,12 @@ int main(int argc, char **argv) {
bs412_audio_gain = 0.9f * bs412_audio_gain + 0.1f * target_gain;
audio *= bs412_audio_gain;
} else if (peak_mpower > (mpx_power + 0.1f)) {
float target_gain = dbr_to_deviation(mpx_power - mpower)/mpx_deviation;
float excess_power = peak_mpower - mpx_power - 0.1f;
excess_power = deviation_to_dbr(dbr_to_deviation(excess_power) - dbr_to_deviation(peak_mpx_only));
float target_gain = dbr_to_deviation(-excess_power)/mpx_deviation;
bs412_audio_gain = 0.8f * bs412_audio_gain + 0.2f * target_gain;
audio *= bs412_audio_gain;
}
iirfilt_rrrf_execute(mpx_lpf, audio, &audio); // Should have no effect, as audio should be 0-15, and 23-53, this is a filter for 53, assuming the filter is good, this is precaution and recomendation