diff --git a/src/pifmrds/fm_mpx.c b/src/pifmrds/fm_mpx.c index 8d2d2dc..85a39d8 100644 --- a/src/pifmrds/fm_mpx.c +++ b/src/pifmrds/fm_mpx.c @@ -193,7 +193,7 @@ int fm_mpx_open(char *filename, size_t len, int raw, double preemphasis, int raw // samples provided by this function are in 0..10: they need to be divided by // 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, float rds_volume) { +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, float rds_volume, int paused) { int stereo_capable = (channels > 1) && (!disablestereo); //chatgpt if(!drds) get_rds_samples(mpx_buffer, length, stereo_capable, rds_ct_enabled, rds_volume); @@ -310,7 +310,10 @@ int fm_mpx_get_samples(float *mpx_buffer, int drds, float compressor_decay, floa if(enablecompressor) out_right=out_right/(right_max+compressor_max_gain_recip); } if(enablecompressor) out_left= out_left/(left_max+compressor_max_gain_recip); // Adjust volume with limited maximum gain - + if(paused) { + out_left = 0; + if(channels > 1) out_right = 0; + } if(drds) mpx_buffer[i] = 0; //do not remove this, the bandwidht will go nuts // Generate the stereo mpx diff --git a/src/pifmrds/fm_mpx.h b/src/pifmrds/fm_mpx.h index c587ccc..8407eb8 100644 --- a/src/pifmrds/fm_mpx.h +++ b/src/pifmrds/fm_mpx.h @@ -22,5 +22,5 @@ */ extern int fm_mpx_open(char *filename, size_t len, int raw, double preemphasis, int rawSampleRate, int rawChannels, float cutoff_freq); -extern 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, float rds_volume); +extern 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, float rds_volume, int paused); extern int fm_mpx_close(); diff --git a/src/pifmrds/pi_fm_rds.cpp b/src/pifmrds/pi_fm_rds.cpp index 1e470cf..645d846 100644 --- a/src/pifmrds/pi_fm_rds.cpp +++ b/src/pifmrds/pi_fm_rds.cpp @@ -223,7 +223,7 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt, } } - if( fm_mpx_get_samples(data, drds, compressor_decay, compressor_attack, compressor_max_gain_recip, disablestereo, gaim, enablecompressor, rds_ct_enabled, rds_volume) < 0 ) { + if( fm_mpx_get_samples(data, drds, compressor_decay, compressor_attack, compressor_max_gain_recip, disablestereo, gaim, enablecompressor, rds_ct_enabled, rds_volume, 0) < 0 ) { terminate(0); } data_len = DATA_SIZE;