add toggle compressor and compressor max gain recip while runtime

This commit is contained in:
Kuba 2024-02-11 21:50:08 +01:00 committed by GitHub
parent e7d9d1f246
commit 88729d9c1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 2 deletions

View File

@ -199,6 +199,18 @@ ResultAndArg poll_control_pipe() {
if(mpx) printf("ON\n"); else printf("OFF\n");
resarg.res = CONTROL_PIPE_MPXGEN_SET;
resarg.arg_int = mpx;
} else if(fifo[0] == 'C' && fifo[1] == 'O' && fifo[2] == 'M') {
int compressor = ( strcmp(arg, "ON") == 0 );
printf("Set Compressor to ");
if(compressor) printf("ON\n"); else printf("OFF\n");
resarg.res = CONTROL_PIPE_COMPRESSOR_SET;
resarg.arg_int = compressor; //bool is just a fancy work for 0 or 1, atleast here
} else if(fifo[0] == 'C' && fifo[1] == 'M' && fifo[2] == 'G') {
printf("Set Compressor Max Gain Recip to ");
printf(arg);
printf("\n");
resarg.res = CONTROL_PIPE_COMPRESSORMAXGAINRECIP_SET;
resarg.arg = arg;
}
}
return resarg;

View File

@ -23,8 +23,10 @@
#define CONTROL_PIPE_CT_SET 16
#define CONTROL_PIPE_RDSVOL_SET 17
#define CONTROL_PIPE_PAUSE_SET 18
#define CONTROL_PIPE_PILVOL_SET 19 //fitting
#define CONTROL_PIPE_PILVOL_SET 19 //fitting, isn't it?
#define CONTROL_PIPE_MPXGEN_SET 20
#define CONTROL_PIPE_COMPRESSOR_SET 21
#define CONTROL_PIPE_COMPRESSORMAXGAINRECIP_SET 23
typedef struct {
int res;

View File

@ -363,7 +363,7 @@ int fm_mpx_get_samples(float *mpx_buffer, int drds, float compressor_decay, floa
}
if(!generate_multiplex) {
mpx_buffer[i] =
0.0; //nothing, rpitx works like this: theres a array with data and rpitx goes thought it to transmit it, now here the functions with the mpx_buffer such as this one update the array, but what if the array is not updated? well, then it keeps transmitting the exact same thing, it doesnt update whats its transmitting, no really, take a sdr and remove this and turn off the mpx gen, if no music then look at rds
0.0; //nothing, rpitx works like this (i think): theres a array with data and rpitx goes thought it to transmit it, now here the functions with the mpx_buffer such as this one update the array, but what if the array is not updated? well, then it keeps transmitting the exact same thing, it doesnt update whats its transmitting, no really, take a sdr and remove this and turn off the mpx gen, if no music then look at rds
}
audio_pos++;

View File

@ -190,6 +190,10 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
pilot_volume = std::stof(pollResult.arg);
} else if(pollResult.res == CONTROL_PIPE_MPXGEN_SET) {
generate_multiplex = pollResult.arg_int;
} else if(pollResult.res == CONTROL_PIPE_COMPRESSOR_SET) {
enablecompressor = pollResult.arg_int;
} else if(pollResult.res == CONTROL_PIPE_COMPRESSORMAXGAINRECIP_SET) {
compressor_max_gain_recip = std::stof(pollResult.arg);
}
}