From 5c0e406dfb7fa4f7b590ce640b02ccde96070357 Mon Sep 17 00:00:00 2001 From: Kuba <132459354+KubaPro010@users.noreply.github.com> Date: Fri, 3 Nov 2023 10:22:32 +0000 Subject: [PATCH] rds volume? --- src/pifmrds/fm_mpx.c | 2 +- src/pifmrds/rds.c | 4 ++-- src/pifmrds/rds.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pifmrds/fm_mpx.c b/src/pifmrds/fm_mpx.c index db047c5..2bdd330 100644 --- a/src/pifmrds/fm_mpx.c +++ b/src/pifmrds/fm_mpx.c @@ -195,7 +195,7 @@ int fm_mpx_open(char *filename, size_t len, int raw, double preemphasis, int raw // 10 after. int fm_mpx_get_samples(float *mpx_buffer, int drds, float compressor_decay, float compressor_attack, float compressor_max_gain_recip, int disablestereo, float gain, int enablecompressor, int rds_ct_enabled) { int stereo_capable = (channels > 1) && (!disablestereo); //chatgpt - if(!drds) get_rds_samples(mpx_buffer, length, stereo_capable, rds_ct_enabled); + if(!drds) get_rds_samples(mpx_buffer, length, stereo_capable, rds_ct_enabled, 1.0); if(inf == NULL) return 0; // if there is no audio, stop here diff --git a/src/pifmrds/rds.c b/src/pifmrds/rds.c index 4714d84..85258d8 100644 --- a/src/pifmrds/rds.c +++ b/src/pifmrds/rds.c @@ -185,7 +185,7 @@ void get_rds_group(int *buffer, int stereo, int ct_clock_enabled) { envelope with a 57 kHz carrier, which is very efficient as 57 kHz is 4 times the sample frequency we are working at (228 kHz). */ -void get_rds_samples(float *buffer, int count, int stereo, int ct_clock_enabled) { +void get_rds_samples(float *buffer, int count, int stereo, int ct_clock_enabled, float sample_volume) { static int bit_buffer[BITS_PER_GROUP]; static int bit_pos = BITS_PER_GROUP; static float sample_buffer[SAMPLE_BUFFER_SIZE] = {0}; @@ -248,7 +248,7 @@ void get_rds_samples(float *buffer, int count, int stereo, int ct_clock_enabled) phase++; if(phase >= 4) phase = 0; - *buffer++ = sample; + *buffer++ = (sample * sample_volume); sample_count++; } } diff --git a/src/pifmrds/rds.h b/src/pifmrds/rds.h index bced71b..f289c7e 100644 --- a/src/pifmrds/rds.h +++ b/src/pifmrds/rds.h @@ -24,7 +24,7 @@ #include -extern void get_rds_samples(float *buffer, int count, int stereo, int ct_clock_enabled); +extern void get_rds_samples(float *buffer, int count, int stereo, int ct_clock_enabled, float sample_volume=1.0); extern void set_rds_pi(uint16_t pi_code); extern void set_rds_rt(char *rt); extern void set_rds_ps(char *ps);