mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-27 11:33:54 +01:00
add reload warnings and run clock at 1187.5 khz instead of 4750
This commit is contained in:
19
src/fm95.c
19
src/fm95.c
@@ -98,6 +98,13 @@ typedef struct {
|
||||
FM95_DeviceNames* devices;
|
||||
} FM95_SetupContext;
|
||||
|
||||
bool compare_dvs(const FM95_DeviceNames *a, const FM95_DeviceNames *b) {
|
||||
return strcmp(a->input, b->input) == 0 &&
|
||||
strcmp(a->output, b->output) == 0 &&
|
||||
strcmp(a->mpx, b->mpx) == 0 &&
|
||||
strcmp(a->rds, b->rds) == 0;
|
||||
}
|
||||
|
||||
static void stop(int signum) {
|
||||
(void)signum;
|
||||
printf("\nReceived stop signal.\n");
|
||||
@@ -219,8 +226,8 @@ int run_fm95(const FM95_Config config, FM95_Runtime* runtime) {
|
||||
if(rds_on && config.stereo != 2) { // disable rds on polar stereo
|
||||
float rds_level = config.volumes.rds;
|
||||
for(uint8_t stream = 0; stream < config.rds_streams; stream++) {
|
||||
uint8_t osc_stream = 12 + stream;
|
||||
if(osc_stream == 13) osc_stream++;
|
||||
uint8_t osc_stream = 48 + (stream*4);
|
||||
if(osc_stream >= 52) osc_stream += 4;
|
||||
|
||||
mpx += (runtime->rds_in[config.rds_streams * i + stream] * get_oscillator_cos_multiplier_ni(&runtime->osc, osc_stream)) * rds_level;
|
||||
|
||||
@@ -431,7 +438,7 @@ void init_runtime(FM95_Runtime* runtime, FM95_Config config, bool rds_on) {
|
||||
init_oscillator(&runtime->osc, (config.calibration == 2) ? 60 : 400, config.sample_rate);
|
||||
return;
|
||||
}
|
||||
else init_oscillator(&runtime->osc, (config.stereo == 2) ? 7812.5 : 4750, config.sample_rate);
|
||||
else init_oscillator(&runtime->osc, (config.stereo == 2) ? 1953.125 : 1187.5, config.sample_rate);
|
||||
|
||||
if(config.lpf_cutoff != 0) {
|
||||
runtime->lpf_l = iirfilt_rrrf_create_prototype(LIQUID_IIRDES_CHEBY2, LIQUID_IIRDES_LOWPASS, LIQUID_IIRDES_SOS, config.lpf_order, (config.lpf_cutoff/config.sample_rate), 0.0f, 1.0f, 60.0f);
|
||||
@@ -450,7 +457,7 @@ void init_runtime(FM95_Runtime* runtime, FM95_Config config, bool rds_on) {
|
||||
|
||||
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, 16.0f, &runtime->osc, (config.stereo == 2), config.volumes.mono, config.volumes.pilot, config.volumes.stereo);
|
||||
|
||||
if(config.agc_max != 0.0) {
|
||||
last_gain = 1.0f;
|
||||
@@ -511,6 +518,7 @@ int main(int argc, char **argv) {
|
||||
.mpx = "\0",
|
||||
.rds = "\0"
|
||||
};
|
||||
FM95_DeviceNames old_dv_names = dv_names;
|
||||
|
||||
int err;
|
||||
err = parse_arguments(argc, argv, &config);
|
||||
@@ -560,6 +568,9 @@ int main(int argc, char **argv) {
|
||||
printf("Could not parse the config file. (error code as return code)\n");
|
||||
return err;
|
||||
}
|
||||
if(!compare_dvs(&dv_names, &old_dv_names)) printf("Warning! Audio Device name changes are not reloaded, please restart for that to take effect.\n");
|
||||
old_dv_names = dv_names;
|
||||
if(config.rds_streams != old_streams) printf("Warning! change of rds_streams requires a restart, not a reload.\n");
|
||||
config.rds_streams = old_streams;
|
||||
cleanup_runtime(&runtime, config);
|
||||
init_runtime(&runtime, config, rds_on);
|
||||
|
||||
Reference in New Issue
Block a user