add rdsgen

This commit is contained in:
2025-03-14 18:49:42 +01:00
parent 63b8b21743
commit 7e8f616a3d
3 changed files with 12 additions and 1 deletions
+6 -1
View File
@@ -220,6 +220,10 @@ static void handle_level(unsigned char *arg) {
set_rds_level(strtoul((char *)arg, NULL, 10)/255.0f); set_rds_level(strtoul((char *)arg, NULL, 10)/255.0f);
} }
static void handle_rdsgen(unsigned char *arg) {
set_rds_gen(strtoul((char *)arg, NULL, 10));
}
static void handle_udg1(unsigned char *arg) { static void handle_udg1(unsigned char *arg) {
uint16_t blocks[8][3]; uint16_t blocks[8][3];
int sets = 0; int sets = 0;
@@ -323,7 +327,8 @@ static const command_handler_t commands_eq6[] = {
static const command_handler_t commands_eq7[] = { static const command_handler_t commands_eq7[] = {
{"PTYNEN", handle_ptynen, 6}, {"PTYNEN", handle_ptynen, 6},
{"RTPRUN", handle_rtprun, 6}, {"RTPRUN", handle_rtprun, 6},
{"GRPSEQ", handle_grpseq, 6} {"GRPSEQ", handle_grpseq, 6},
{"RDSGEN", handle_rdsgen, 6}
}; };
static const command_handler_t commands_eq8[] = { static const command_handler_t commands_eq8[] = {
+5
View File
@@ -7,6 +7,7 @@ static struct rds_t rds;
static float waveform[2][FILTER_SIZE]; static float waveform[2][FILTER_SIZE];
static float level; static float level;
static uint8_t rdsgen;
void init_rds_objects() { void init_rds_objects() {
level = 1.0f; level = 1.0f;
@@ -25,6 +26,9 @@ void init_rds_objects() {
void set_rds_level(float _level) { void set_rds_level(float _level) {
level = fminf(1.0f, fmaxf(0.0f, _level)); level = fminf(1.0f, fmaxf(0.0f, _level));
} }
void set_rds_gen(uint8_t rdsgen) {
rdsgen = min(1, max(0, rdsgen)); // No RDS2
}
/* Get an RDS sample. This generates the envelope of the waveform using /* Get an RDS sample. This generates the envelope of the waveform using
* pre-generated elementary waveform samples. * pre-generated elementary waveform samples.
@@ -67,5 +71,6 @@ float get_rds_sample() {
rds.sample_buffer[rds.out_sample_index++] = 0; rds.sample_buffer[rds.out_sample_index++] = 0;
if (rds.out_sample_index == SAMPLE_BUFFER_SIZE) if (rds.out_sample_index == SAMPLE_BUFFER_SIZE)
rds.out_sample_index = 0; rds.out_sample_index = 0;
if(rdsgen == 0) sample = 0.0f;
return sample*level; return sample*level;
} }
+1
View File
@@ -13,3 +13,4 @@ typedef struct rds_t {
extern void init_rds_objects(); extern void init_rds_objects();
extern void set_rds_level(float _level); extern void set_rds_level(float _level);
extern void set_rds_gen(uint8_t rdsgen);