a bit of a pause implemented

This commit is contained in:
Kuba 2023-11-07 12:37:54 +00:00
parent 2b706c2f1d
commit ebd13e8036
3 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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();

View File

@ -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;