add some standards

This commit is contained in:
2026-07-12 22:16:56 +02:00
parent baca631ffb
commit fa6f69077b
9 changed files with 14 additions and 7 deletions
+4
View File
@@ -41,6 +41,10 @@ Should run completly fine on a pi 5, fine on a pi 3b (~30% cpu)
FM95 also includes some other apps, such as chimer95 which generates GTS tones each half hour, and vban95 now which is a buffered VBAN receiver. And now also SCA generation was moved to sca95 from fm95! FM95 also includes some other apps, such as chimer95 which generates GTS tones each half hour, and vban95 now which is a buffered VBAN receiver. And now also SCA generation was moved to sca95 from fm95!
## Feature Requests
In case you are missing something, you can create an issue, and if you actually do need the feature and can prove it, and also provide/tell how to test the feature - any feature is welcome to be implemented (though i never said when will it be done)
## Usage of other projects ## Usage of other projects
The apps use inih by Ben Hoyt. The apps use inih by Ben Hoyt.
-2
View File
@@ -2,7 +2,6 @@
void init_oscillator(Oscillator *osc, float frequency, float sample_rate) { void init_oscillator(Oscillator *osc, float frequency, float sample_rate) {
osc->phase = 0.0f; osc->phase = 0.0f;
osc->unwrapped_phase = 0.0;
osc->phase_increment = (M_2PI * frequency) / sample_rate; osc->phase_increment = (M_2PI * frequency) / sample_rate;
osc->sample_rate = sample_rate; osc->sample_rate = sample_rate;
} }
@@ -33,7 +32,6 @@ float get_oscillator_cos_multiplier_ni(Oscillator *osc, float multiplier) {
inline bool advance_oscillator(Oscillator *osc) { inline bool advance_oscillator(Oscillator *osc) {
osc->phase += osc->phase_increment; osc->phase += osc->phase_increment;
osc->unwrapped_phase += osc->phase_increment;
if (osc->phase >= M_2PI) { if (osc->phase >= M_2PI) {
osc->phase -= M_2PI; osc->phase -= M_2PI;
return true; return true;
-1
View File
@@ -6,7 +6,6 @@
typedef struct { typedef struct {
float phase; float phase;
double unwrapped_phase;
float phase_increment; float phase_increment;
float sample_rate; float sample_rate;
} Oscillator; } Oscillator;
+10 -4
View File
@@ -257,7 +257,7 @@ int run_fm95(FM95_Config* config, FM95_Runtime* runtime, FM95_RunResult* result)
uint8_t osc_stream = 12 + stream; uint8_t osc_stream = 12 + stream;
if (osc_stream >= 13) osc_stream++; // "The first position, 61,75 kHz is not used to protect the basic subcarrier of 57 kHz on existing receivers." - IEC 62106-1 if (osc_stream >= 13) osc_stream++; // "The first position, 61,75 kHz is not used to protect the basic subcarrier of 57 kHz on existing receivers." - IEC 62106-1
float shaped = 0.0f; float shaped;
iirfilt_rrrf_execute(runtime->rds_filter[stream], runtime->rds_symbol[stream], &shaped); iirfilt_rrrf_execute(runtime->rds_filter[stream], runtime->rds_symbol[stream], &shaped);
float carrier = get_oscillator_cos_multiplier_ni(&runtime->osc, osc_stream * 4.0f); float carrier = get_oscillator_cos_multiplier_ni(&runtime->osc, osc_stream * 4.0f);
@@ -338,12 +338,18 @@ static int config_handler(void* user, const char* section, const char* name, con
else if(MATCH("advanced", "lpf_order")) pconfig->lpf_order = atoi(value); else if(MATCH("advanced", "lpf_order")) pconfig->lpf_order = atoi(value);
else if(MATCH("advanced", "stereo_ssb")) pconfig->stereo_ssb = atoi(value); else if(MATCH("advanced", "stereo_ssb")) pconfig->stereo_ssb = atoi(value);
else if(MATCH("advanced", "preemp_unity")) pconfig->preemp_unity_freq = strtof(value, NULL); else if(MATCH("advanced", "preemp_unity")) pconfig->preemp_unity_freq = strtof(value, NULL);
else if(MATCH("advanced", "sample_rate")) pconfig->sample_rate = atoi(value); else if(MATCH("advanced", "sample_rate")) {
else if(MATCH("advanced", "lpf_cutoff")) { pconfig->sample_rate = atoi(value);
if(pconfig->sample_rate < 0) {
fprintf(stderr, "Negative sample rate\n");
return 0;
}
} else if(MATCH("advanced", "lpf_cutoff")) {
pconfig->lpf_cutoff = strtof(value, NULL); pconfig->lpf_cutoff = strtof(value, NULL);
if(pconfig->lpf_cutoff > (pconfig->sample_rate * 0.5)) { if(pconfig->lpf_cutoff > (pconfig->sample_rate * 0.5)) {
pconfig->lpf_cutoff = (pconfig->sample_rate * 0.5); pconfig->lpf_cutoff = (pconfig->sample_rate * 0.5);
fprintf(stderr, "LPF cutoff over niquist, limiting.\n"); fprintf(stderr, "LPF cutoff over niquist.\n");
return 0;
} }
} else if(MATCH("advanced", "headroom")) pconfig->volumes.headroom = strtof(value, NULL); } else if(MATCH("advanced", "headroom")) pconfig->volumes.headroom = strtof(value, NULL);
else if(MATCH("advanced", "drive")) pconfig->volumes.drive = strtof(value, NULL); else if(MATCH("advanced", "drive")) pconfig->volumes.drive = strtof(value, NULL);