From 3bf4fe1039e49c22e73af6b74dfdc815b348fdae Mon Sep 17 00:00:00 2001 From: Kuba <132459354+KubaPro010@users.noreply.github.com> Date: Tue, 7 Nov 2023 13:13:50 +0000 Subject: [PATCH] pause (no buffer) --- src/pifmrds/control_pipe.c | 6 ++++++ src/pifmrds/control_pipe.h | 1 + src/pifmrds/pi_fm_rds.cpp | 6 ++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pifmrds/control_pipe.c b/src/pifmrds/control_pipe.c index 113f050..c5d817a 100644 --- a/src/pifmrds/control_pipe.c +++ b/src/pifmrds/control_pipe.c @@ -181,6 +181,12 @@ ResultAndArg poll_control_pipe() { printf("\n"); resarg.res = CONTROL_PIPE_RDSVOL_SET; 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; diff --git a/src/pifmrds/control_pipe.h b/src/pifmrds/control_pipe.h index 0651244..d79c5df 100644 --- a/src/pifmrds/control_pipe.h +++ b/src/pifmrds/control_pipe.h @@ -22,6 +22,7 @@ #define CONTROL_PIPE_COMPRESSORATTACK_SET 15 #define CONTROL_PIPE_CT_SET 16 #define CONTROL_PIPE_RDSVOL_SET 17 +#define CONTROL_PIPE_PAUSE_SET 18 typedef struct { int res; diff --git a/src/pifmrds/pi_fm_rds.cpp b/src/pifmrds/pi_fm_rds.cpp index e630027..163cc97 100644 --- a/src/pifmrds/pi_fm_rds.cpp +++ b/src/pifmrds/pi_fm_rds.cpp @@ -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) deviation_scale_factor= 0.1 * (deviation ) ; // todo PPM } - + int paused = 0; for (;;) { 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; } else if(pollResult.res == CONTROL_PIPE_RDSVOL_SET) { 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); } data_len = DATA_SIZE;