ima implement some stereo tool function

This commit is contained in:
Kuba 2023-11-15 17:59:38 +00:00
parent 065688f5c2
commit fd295a7acf
3 changed files with 4 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 // samples provided by this function are in 0..10: they need to be divided by
// 10 after. // 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 paused) { 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, float pilot_volume) {
int stereo_capable = (channels > 1) && (!disablestereo); //chatgpt int stereo_capable = (channels > 1) && (!disablestereo); //chatgpt
if(!drds) get_rds_samples(mpx_buffer, length, stereo_capable, rds_ct_enabled, rds_volume); if(!drds) get_rds_samples(mpx_buffer, length, stereo_capable, rds_ct_enabled, rds_volume);
@ -321,7 +321,7 @@ int fm_mpx_get_samples(float *mpx_buffer, int drds, float compressor_decay, floa
if(!disablestereo) { if(!disablestereo) {
mpx_buffer[i] += 4.05*(out_left+out_right) + // Stereo sum signal mpx_buffer[i] += 4.05*(out_left+out_right) + // Stereo sum signal
4.05 * carrier_38[phase_38] * (out_left-out_right) + // Stereo difference signal 4.05 * carrier_38[phase_38] * (out_left-out_right) + // Stereo difference signal
.9*carrier_19[phase_19]; // Stereo pilot tone (pilot_volume-0.1)*carrier_19[phase_19]; // Stereo pilot tone (doing 0.1 minus to balance it out, as by default its 0.9, but to make the 1.0 the normal value of the volume)
phase_19++; phase_19++;
phase_38++; phase_38++;

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_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, int paused); 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, float pilot_volume);
extern int fm_mpx_close(); extern int fm_mpx_close();

View File

@ -226,7 +226,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, paused) < 0 ) { if( fm_mpx_get_samples(data, drds, compressor_decay, compressor_attack, compressor_max_gain_recip, disablestereo, gaim, enablecompressor, rds_ct_enabled, rds_volume, paused, 1.0) < 0 ) {
terminate(0); terminate(0);
} }
data_len = DATA_SIZE; data_len = DATA_SIZE;