From 1b11110a39975449fab5996bcb2d0b3001512da1 Mon Sep 17 00:00:00 2001 From: Kuba <132459354+KubaPro010@users.noreply.github.com> Date: Tue, 31 Oct 2023 14:53:19 +0000 Subject: [PATCH] 2nd step --- src/pifmrds/control_pipe.c | 6 ++++++ src/pifmrds/control_pipe.h | 1 + src/pifmrds/pi_fm_rds.cpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/src/pifmrds/control_pipe.c b/src/pifmrds/control_pipe.c index b27c548..c457b25 100644 --- a/src/pifmrds/control_pipe.c +++ b/src/pifmrds/control_pipe.c @@ -145,6 +145,12 @@ ResultAndArg poll_control_pipe() { printf("\n"); resarg.res = CONTROL_PIPE_DEVIATION_SET; resarg.arg = arg; + else if(fifo[0] == 'G' && fifo[1] == 'A' && fifo[2] == 'I') { + printf("Set Gain to "); + printf(arg); + printf("\n"); + resarg.res = CONTROL_PIPE_GAIN_SET; + resarg.arg = arg; } else if(fifo[0] == 'S' && fifo[1] == 'T' && fifo[2] == 'R') { int togg = ( strcmp(arg, "OFF") == 0 ); printf("Set Stereo Toggle to "); diff --git a/src/pifmrds/control_pipe.h b/src/pifmrds/control_pipe.h index f9284ba..8838ce5 100644 --- a/src/pifmrds/control_pipe.h +++ b/src/pifmrds/control_pipe.h @@ -17,6 +17,7 @@ #define CONTROL_PIPE_RDS_SET 10 #define CONTROL_PIPE_DEVIATION_SET 11 #define CONTROL_PIPE_STEREO_SET 12 +#define CONTROL_PIPE_GAIN_SET 13 typedef struct { int res; diff --git a/src/pifmrds/pi_fm_rds.cpp b/src/pifmrds/pi_fm_rds.cpp index 5816fbd..7ea5d25 100644 --- a/src/pifmrds/pi_fm_rds.cpp +++ b/src/pifmrds/pi_fm_rds.cpp @@ -199,6 +199,8 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt, deviation_scale_factor= 0.1 * (deviation ); } else if(pollResult.res == CONTROL_PIPE_STEREO_SET) { disablestereo = (int)pollResult.arg; + } else if(pollResult.res == CONTROL_PIPE_GAIN_SET) { + gaim = (float)pollResult.arg; } }