This commit is contained in:
Kuba 2023-11-04 10:15:23 +00:00
parent 7ec59ca9a3
commit 99a5261480
2 changed files with 10 additions and 6 deletions

View File

@ -107,7 +107,7 @@ ResultAndArg poll_control_pipe() {
int ct = ( strcmp(arg, "ON") == 0 );
printf("Set CT to ");
if(ct) printf("ON\n"); else printf("OFF\n");
resarg.arg = (char)ct;
resarg.arg = (char*)ct;
resarg.res = CONTROL_PIPE_CT_SET;
}
} else if(strlen(fifo) > 4 && fifo[3] == ' ') {

View File

@ -82,6 +82,10 @@ static volatile void *map_peripheral(uint32_t base, uint32_t len)
}
int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt, float ppm, char *control_pipe, int pty, int *af_array, int raw, int drds, double preemp, int power, int rawSampleRate, int rawChannels, int deviation, int ta, int tp, float cutoff_freq, float gaim, float compressor_decay, float compressor_attack, float compressor_max_gain_recip, int enablecompressor, int rds_ct_enabled, float rds_volume) {
int stereo_on = 1;
int ct_on = rds_ct_enabled;
int rdsvol = 1;
int disablerds = drds;
// Catch all signals possible - it is vital we kill the DMA engine
// on process exit!
// for (int i = 0; i < 64; i++) {
@ -201,7 +205,7 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
if(pollResult.res == CONTROL_PIPE_PS_SET) {
varying_ps = 0;
} else if(pollResult.res == CONTROL_PIPE_RDS_SET) {
drds = std::stoi(pollResult.arg);
disablerds = std::stoi(pollResult.arg);
} else if(pollResult.res == CONTROL_PIPE_PWR_SET) {
pad_reg[GPIO_PAD_0_27] = 0x5a000018 + std::stoi(pollResult.arg);
pad_reg[GPIO_PAD_28_45] = 0x5a000018 + std::stoi(pollResult.arg);
@ -209,7 +213,7 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
deviation = std::stoi(pollResult.arg);
deviation_scale_factor= 0.1 * (deviation );
} else if(pollResult.res == CONTROL_PIPE_STEREO_SET) {
disablestereo = std::stoi(pollResult.arg);
stereo_on = std::stoi(pollResult.arg);
} else if(pollResult.res == CONTROL_PIPE_GAIN_SET) {
gaim = std::stof(pollResult.arg);
} else if(pollResult.res == CONTROL_PIPE_COMPRESSORDECAY_SET) {
@ -217,13 +221,13 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
} else if(pollResult.res == CONTROL_PIPE_COMPRESSORATTACK_SET) {
compressor_attack = std::stof(pollResult.arg);
} else if(pollResult.res == CONTROL_PIPE_CT_SET) {
rds_ct_enabled = std::stoi(pollResult.arg);
ct_on = std::stoi(pollResult.arg);
} else if(pollResult.res == CONTROL_PIPE_RDSVOL_SET) {
rds_volume = std::stof(pollResult.arg);
rdsvol = std::stof(pollResult.arg);
}
}
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, disablerds, compressor_decay, compressor_attack, compressor_max_gain_recip, stereo_on, gaim, enablecompressor, ct_on, rdsvol) < 0 ) {
terminate(0);
}
data_len = DATA_SIZE;