mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-27 03:23:54 +01:00
add reload warnings and run clock at 1187.5 khz instead of 4750
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": 1754228131242,
|
"time": 1754247434245,
|
||||||
"version": "0.0.3"
|
"version": "0.0.3"
|
||||||
}
|
}
|
||||||
19
src/fm95.c
19
src/fm95.c
@@ -98,6 +98,13 @@ typedef struct {
|
|||||||
FM95_DeviceNames* devices;
|
FM95_DeviceNames* devices;
|
||||||
} FM95_SetupContext;
|
} 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) {
|
static void stop(int signum) {
|
||||||
(void)signum;
|
(void)signum;
|
||||||
printf("\nReceived stop signal.\n");
|
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
|
if(rds_on && config.stereo != 2) { // disable rds on polar stereo
|
||||||
float rds_level = config.volumes.rds;
|
float rds_level = config.volumes.rds;
|
||||||
for(uint8_t stream = 0; stream < config.rds_streams; stream++) {
|
for(uint8_t stream = 0; stream < config.rds_streams; stream++) {
|
||||||
uint8_t osc_stream = 12 + stream;
|
uint8_t osc_stream = 48 + (stream*4);
|
||||||
if(osc_stream == 13) osc_stream++;
|
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;
|
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);
|
init_oscillator(&runtime->osc, (config.calibration == 2) ? 60 : 400, config.sample_rate);
|
||||||
return;
|
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) {
|
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);
|
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);
|
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) {
|
if(config.agc_max != 0.0) {
|
||||||
last_gain = 1.0f;
|
last_gain = 1.0f;
|
||||||
@@ -511,6 +518,7 @@ int main(int argc, char **argv) {
|
|||||||
.mpx = "\0",
|
.mpx = "\0",
|
||||||
.rds = "\0"
|
.rds = "\0"
|
||||||
};
|
};
|
||||||
|
FM95_DeviceNames old_dv_names = dv_names;
|
||||||
|
|
||||||
int err;
|
int err;
|
||||||
err = parse_arguments(argc, argv, &config);
|
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");
|
printf("Could not parse the config file. (error code as return code)\n");
|
||||||
return err;
|
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;
|
config.rds_streams = old_streams;
|
||||||
cleanup_runtime(&runtime, config);
|
cleanup_runtime(&runtime, config);
|
||||||
init_runtime(&runtime, config, rds_on);
|
init_runtime(&runtime, config, rds_on);
|
||||||
|
|||||||
Reference in New Issue
Block a user