mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-26 19:23:51 +01:00
keep gain across reloads
This commit is contained in:
2
.vscode/.server-controller-port.log
vendored
2
.vscode/.server-controller-port.log
vendored
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"port": 13452,
|
"port": 13452,
|
||||||
"time": 1752319108014,
|
"time": 1754149596407,
|
||||||
"version": "0.0.3"
|
"version": "0.0.3"
|
||||||
}
|
}
|
||||||
@@ -443,13 +443,20 @@ void init_runtime(FM95_Runtime* runtime, FM95_Config config, bool rds_on) {
|
|||||||
init_preemphasis(&runtime->preemp_r, config.preemphasis, config.sample_rate, config.preemp_unity_freq);
|
init_preemphasis(&runtime->preemp_r, config.preemphasis, config.sample_rate, config.preemp_unity_freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float last_gain = 0.0f;
|
||||||
|
if(runtime->bs412.sample_rate == config.sample_rate) last_gain = runtime->bs412.gain;
|
||||||
init_bs412(&runtime->bs412, config.mpx_deviation, config.mpx_power, config.bs412_attack, config.bs412_release, config.bs412_max, config.sample_rate);
|
init_bs412(&runtime->bs412, config.mpx_deviation, config.mpx_power, config.bs412_attack, config.bs412_release, config.bs412_max, config.sample_rate);
|
||||||
|
runtime->bs412.gain = last_gain;
|
||||||
|
|
||||||
if(config.tilt != 0) tilt_init(&runtime->tilter, config.tilt);
|
if(config.tilt != 0) tilt_init(&runtime->tilter, config.tilt);
|
||||||
|
|
||||||
init_stereo_encoder(&runtime->stencode, 4.0f, &runtime->osc, (config.stereo == 2), config.volumes.mono, config.volumes.pilot, config.volumes.stereo);
|
init_stereo_encoder(&runtime->stencode, 4.0f, &runtime->osc, (config.stereo == 2), config.volumes.mono, config.volumes.pilot, config.volumes.stereo);
|
||||||
|
|
||||||
if(config.agc_max != 0.0) initAGC(&runtime->agc, config.sample_rate, config.agc_target, config.agc_min, config.agc_max, config.agc_attack, config.agc_release);
|
if(config.agc_max != 0.0) {
|
||||||
|
if(runtime->agc.sampleRate == config.sample_rate) last_gain = runtime->agc.currentGain;
|
||||||
|
initAGC(&runtime->agc, config.sample_rate, config.agc_target, config.agc_min, config.agc_max, config.agc_attack, config.agc_release);
|
||||||
|
runtime->agc.currentGain = last_gain;
|
||||||
|
}
|
||||||
|
|
||||||
if(rds_on) memset(runtime->rds_in, 0, sizeof(float) * BUFFER_SIZE * config.rds_streams);
|
if(rds_on) memset(runtime->rds_in, 0, sizeof(float) * BUFFER_SIZE * config.rds_streams);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user