mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-07-29 15:59:14 +02:00
change the power measurement logic for mpx only a bit
This commit is contained in:
+2
-3
@@ -16,7 +16,6 @@
|
|||||||
#define DEFAULT_MPX_POWER 3.0f // dbr, this is for BS412, simplest bs412
|
#define DEFAULT_MPX_POWER 3.0f // dbr, this is for BS412, simplest bs412
|
||||||
#define DEFAULT_MPX_DEVIATION 75000.0f // for BS412
|
#define DEFAULT_MPX_DEVIATION 75000.0f // for BS412
|
||||||
|
|
||||||
#include "../lib/constants.h"
|
|
||||||
#include "../lib/oscillator.h"
|
#include "../lib/oscillator.h"
|
||||||
#include "../lib/filters.h"
|
#include "../lib/filters.h"
|
||||||
#include "../lib/fm_modulator.h"
|
#include "../lib/fm_modulator.h"
|
||||||
@@ -543,9 +542,9 @@ int main(int argc, char **argv) {
|
|||||||
if(sca_on) mpx += modulate_fm(&sca_mod, hard_clip(current_sca_in, sca_clipper_threshold))*SCA_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);
|
float mpower = measure_mpx(&power, (audio+mpx) * mpx_deviation) - mpx_only;
|
||||||
if (mpower > mpx_power) {
|
if (mpower > mpx_power) {
|
||||||
float excess_power = mpower - mpx_power - mpx_only;
|
float excess_power = mpower - mpx_power;
|
||||||
audio *= (dbr_to_deviation(-excess_power)/mpx_deviation);
|
audio *= (dbr_to_deviation(-excess_power)/mpx_deviation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user