pause (no buffer)

This commit is contained in:
Kuba 2023-11-07 13:13:50 +00:00
parent b9892a2019
commit 3bf4fe1039
3 changed files with 11 additions and 2 deletions

View File

@ -181,6 +181,12 @@ ResultAndArg poll_control_pipe() {
printf("\n"); printf("\n");
resarg.res = CONTROL_PIPE_RDSVOL_SET; resarg.res = CONTROL_PIPE_RDSVOL_SET;
resarg.arg = arg; resarg.arg = arg;
} else if(fifo[0] == 'P' && fifo[1] == 'A' && fifo[2] == 'U') {
int togg = ( strcmp(arg, "OFF") == 0 );
printf("Set paused to ");
if(!togg) printf("ON\n"); else printf("OFF\n");
resarg.res = CONTROL_PIPE_PAUSE_SET;
resarg.arg_int = togg;
} }
} }
return resarg; return resarg;

View File

@ -22,6 +22,7 @@
#define CONTROL_PIPE_COMPRESSORATTACK_SET 15 #define CONTROL_PIPE_COMPRESSORATTACK_SET 15
#define CONTROL_PIPE_CT_SET 16 #define CONTROL_PIPE_CT_SET 16
#define CONTROL_PIPE_RDSVOL_SET 17 #define CONTROL_PIPE_RDSVOL_SET 17
#define CONTROL_PIPE_PAUSE_SET 18
typedef struct { typedef struct {
int res; int res;

View File

@ -178,7 +178,7 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
// and about 2.5kHz for NFM (walkie-talkie style radio) // and about 2.5kHz for NFM (walkie-talkie style radio)
deviation_scale_factor= 0.1 * (deviation ) ; // todo PPM deviation_scale_factor= 0.1 * (deviation ) ; // todo PPM
} }
int paused = 0;
for (;;) for (;;)
{ {
if(drds == 0) { if(drds == 0) {
@ -221,10 +221,12 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
rds_ct_enabled = pollResult.arg_int; rds_ct_enabled = pollResult.arg_int;
} else if(pollResult.res == CONTROL_PIPE_RDSVOL_SET) { } else if(pollResult.res == CONTROL_PIPE_RDSVOL_SET) {
rds_volume = std::stof(pollResult.arg); rds_volume = std::stof(pollResult.arg);
} else if(pollResult.res == CONTROL_PIPE_PAUSE_SET) {
paused = pollResult.arg_int;
} }
} }
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 ) { 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 ) {
terminate(0); terminate(0);
} }
data_len = DATA_SIZE; data_len = DATA_SIZE;