mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-26 19:23:51 +01:00
add peak power limit to bs412
This commit is contained in:
@@ -569,6 +569,8 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
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); // Standard requires that the output is measured specifically
|
float mpower = measure_mpx(&power, (audio+mpx) * mpx_deviation); // Standard requires that the output is measured specifically
|
||||||
|
float peak_mpx_only = deviation_to_dbr(mpx * mpx_deviation);
|
||||||
|
float peak_mpower = deviation_to_dbr((audio+mpx) * mpx_deviation);
|
||||||
if (mpower > mpx_power) {
|
if (mpower > mpx_power) {
|
||||||
float excess_power = mpower - mpx_power;
|
float excess_power = mpower - mpx_power;
|
||||||
excess_power = deviation_to_dbr(dbr_to_deviation(excess_power) - dbr_to_deviation(mpx_only)); // make sure mpx is not included in the power to attenuate, because we'd be attuating the mpx signal for audio
|
excess_power = deviation_to_dbr(dbr_to_deviation(excess_power) - dbr_to_deviation(mpx_only)); // make sure mpx is not included in the power to attenuate, because we'd be attuating the mpx signal for audio
|
||||||
@@ -576,6 +578,9 @@ int main(int argc, char **argv) {
|
|||||||
float target_gain = dbr_to_deviation(-excess_power)/mpx_deviation;
|
float target_gain = dbr_to_deviation(-excess_power)/mpx_deviation;
|
||||||
bs412_audio_gain = 0.9f * bs412_audio_gain + 0.1f * target_gain;
|
bs412_audio_gain = 0.9f * bs412_audio_gain + 0.1f * target_gain;
|
||||||
audio *= bs412_audio_gain;
|
audio *= bs412_audio_gain;
|
||||||
|
} else if (peak_mpower > (mpx_power + 0.1f)) {
|
||||||
|
float target_gain = dbr_to_deviation(mpx_power - mpower)/mpx_deviation;
|
||||||
|
bs412_audio_gain = 0.8f * bs412_audio_gain + 0.2f * target_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
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user