little changes, note: you need to mod your librpit

This commit is contained in:
KubaPro010 2023-09-27 19:51:10 +02:00
parent 64f5d50598
commit cd48b3f3ac
2 changed files with 20 additions and 11 deletions

View File

@ -312,7 +312,7 @@ int fm_mpx_get_samples(float *mpx_buffer, int drds) {
} }
out_left= out_left/(left_max+compressor_max_gain_recip); // Adjust volume with limited maximum gain out_left= out_left/(left_max+compressor_max_gain_recip); // Adjust volume with limited maximum gain
if(drds) mpx_buffer[i] = 0; if(drds) mpx_buffer[i] = 0; //do not remove this, the bandwidht will go nuts
// Generate the stereo mpx // Generate the stereo mpx
if( channels > 1 ) { if( channels > 1 ) {

View File

@ -126,7 +126,7 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
int varying_ps = 0; int varying_ps = 0;
if(drds == 1) { if(drds == 1) {
printf("RDS Disabled (control pipe too)\n"); printf("RDS Disabled\n");
} else { } else {
if(ps) { if(ps) {
set_rds_ps(ps); set_rds_ps(ps);
@ -146,15 +146,15 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
} }
printf("\n"); printf("\n");
} }
}
// Initialize the control pipe reader // Initialize the control pipe reader
if(control_pipe) { if(control_pipe) {
if(open_control_pipe(control_pipe, pad_reg) == 0) { if(open_control_pipe(control_pipe, pad_reg) == 0) {
printf("Reading control commands on %s.\n", control_pipe); printf("Reading control commands on %s.\n", control_pipe);
} else { } else {
printf("Failed to open control pipe: %s.\n", control_pipe); printf("Failed to open control pipe: %s.\n", control_pipe);
control_pipe = NULL; control_pipe = NULL;
}
} }
} }
@ -218,6 +218,7 @@ int main(int argc, char **argv) {
int ta = 0; int ta = 0;
int tp = 0; int tp = 0;
int af_size = 0; int af_size = 0;
int gpiopin = 0;
int raw = 0; int raw = 0;
int drds = 0; int drds = 0;
int power = 7; int power = 7;
@ -259,6 +260,14 @@ int main(int argc, char **argv) {
} else if(strcmp("-pty", arg)==0 && param != NULL) { } else if(strcmp("-pty", arg)==0 && param != NULL) {
i++; i++;
pty = atoi(param); pty = atoi(param);
} else if(strcmp("-gpiopin", arg)==0 && param != NULL) {
i++;
int pinnum = atoi(param);
if(!pinnum == 4 || !pinnum == 20 || !pinnum == 32 || !pinnum == 34 || !pinnum == 6) {
fatal("Invalid gpio pin, allowed: 4,20,32,34");
} else {
gpiopin = pinnum;
}
} else if(strcmp("-ta", arg)==0) { } else if(strcmp("-ta", arg)==0) {
i++; i++;
ta = 1; ta = 1;
@ -326,7 +335,7 @@ int main(int argc, char **argv) {
} }
alternative_freq[0] = af_size; alternative_freq[0] = af_size;
int FifoSize=DATA_SIZE*2; int FifoSize=DATA_SIZE*2;
fmmod=new ngfmdmasync(carrier_freq,228000,14,FifoSize); fmmod=new ngfmdmasync(carrier_freq,228000,14,FifoSize, false, gpiopin);
int errcode = tx(carrier_freq, audio_file, pi, ps, rt, ppm, control_pipe, pty, alternative_freq, raw, drds, preemp, power, rawSampleRate, rawChannels, deviation, ta, tp); int errcode = tx(carrier_freq, audio_file, pi, ps, rt, ppm, control_pipe, pty, alternative_freq, raw, drds, preemp, power, rawSampleRate, rawChannels, deviation, ta, tp);
terminate(errcode); terminate(errcode);
} }