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
+5
View File
@@ -7,6 +7,7 @@ static struct rds_t rds;
static float waveform[2][FILTER_SIZE];
static float level;
static uint8_t rdsgen;
void init_rds_objects() {
level = 1.0f;
@@ -25,6 +26,9 @@ void init_rds_objects() {
void set_rds_level(float _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
* pre-generated elementary waveform samples.
@@ -67,5 +71,6 @@ float get_rds_sample() {
rds.sample_buffer[rds.out_sample_index++] = 0;
if (rds.out_sample_index == SAMPLE_BUFFER_SIZE)
rds.out_sample_index = 0;
if(rdsgen == 0) sample = 0.0f;
return sample*level;
}