mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-26 11:22:00 +01:00
will thjis commit break everything?
This commit is contained in:
@@ -23,15 +23,11 @@ float get_oscillator_cos_sample(Oscillator *osc) {
|
||||
}
|
||||
|
||||
float get_oscillator_sin_multiplier_ni(Oscillator *osc, float multiplier) {
|
||||
float new_phase = osc->phase * multiplier;
|
||||
new_phase -= (new_phase >= M_2PI) ? M_2PI : 0.0f;
|
||||
return sinf(new_phase);
|
||||
return sinf(osc->phase * multiplier);
|
||||
}
|
||||
|
||||
float get_oscillator_cos_multiplier_ni(Oscillator *osc, float multiplier) {
|
||||
float new_phase = osc->phase * multiplier;
|
||||
new_phase -= (new_phase >= M_2PI) ? M_2PI : 0.0f;
|
||||
return cosf(new_phase);
|
||||
return cosf(osc->phase * multiplier);
|
||||
}
|
||||
|
||||
inline void advance_oscillator(Oscillator *osc) {
|
||||
|
||||
@@ -49,17 +49,12 @@ float bs412_compress(BS412Compressor* mpx, float sample) {
|
||||
}
|
||||
|
||||
if (modulation_power > mpx->target) {
|
||||
float excess_power = modulation_power - mpx->target;
|
||||
float target_gain = mpx->target / modulation_power;
|
||||
|
||||
if (excess_power > 0.0f && excess_power < 10.0f) {
|
||||
float target_gain = dbr_to_deviation(-excess_power) / mpx->mpx_deviation;
|
||||
|
||||
target_gain = fmaxf(target_gain, 0.1f);
|
||||
target_gain = fminf(target_gain, 1.0f);
|
||||
|
||||
mpx->gain = mpx->attack * mpx->gain + (1 - mpx->attack) * target_gain;
|
||||
}
|
||||
} else mpx->gain = fminf(1.0f, mpx->release * mpx->gain + (1 - mpx->release) * 1.0f);
|
||||
mpx->gain = mpx->attack * mpx->gain + (1.0f - mpx->attack) * target_gain;
|
||||
} else {
|
||||
mpx->gain = mpx->release * mpx->gain + (1.0f - mpx->release) * 1.0f;
|
||||
}
|
||||
|
||||
mpx->gain = fminf(mpx->max, mpx->gain);
|
||||
mpx->gain = fmaxf(0.0f, mpx->gain);
|
||||
|
||||
@@ -15,7 +15,7 @@ void initAGC(AGC* agc, int sampleRate, float targetLevel, float minGain, float m
|
||||
agc->currentLevel = 0.0f;
|
||||
|
||||
agc->rms_buffer = 0.0f;
|
||||
agc->rmsAlpha = expf(-1.0f / (sampleRate * 0.02f));
|
||||
agc->rmsAlpha = expf(-1.0f / (sampleRate * 0.025f));
|
||||
}
|
||||
|
||||
float process_agc(AGC* agc, float sidechain) {
|
||||
|
||||
@@ -131,8 +131,8 @@ void cleanup_runtime(FM95_Runtime *rt, bool mpx_on, bool rds_on) {
|
||||
}
|
||||
|
||||
int run_fm95(const FM95_Config config, FM95_Runtime* runtime) {
|
||||
int mpx_on = (runtime->mpx_device.initialized == 1);
|
||||
int rds_on = (runtime->rds_device.initialized == 1);
|
||||
bool mpx_on = (runtime->mpx_device.initialized == 1);
|
||||
bool rds_on = (runtime->rds_device.initialized == 1);
|
||||
|
||||
if(config.calibration != 0) {
|
||||
Oscillator osc;
|
||||
@@ -502,8 +502,8 @@ int main(int argc, char **argv) {
|
||||
FM95_Runtime runtime;
|
||||
memset(&runtime, 0, sizeof(runtime));
|
||||
|
||||
int mpx_on = (strlen(dv_names.mpx) != 0);
|
||||
int rds_on = (strlen(dv_names.rds) != 0 && config.rds_streams != 0);
|
||||
bool mpx_on = (strlen(dv_names.mpx) != 0);
|
||||
bool rds_on = (strlen(dv_names.rds) != 0 && config.rds_streams != 0);
|
||||
|
||||
err = setup_audio(&runtime, dv_names, config, mpx_on, rds_on);
|
||||
if(err != 0) return err;
|
||||
|
||||
Reference in New Issue
Block a user