From fe9b5b51e863587d3ae08b8082215af229e18c9d Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Mon, 1 Apr 2024 11:20:25 -0400 Subject: [PATCH] Reconfigure RTL Volume Multiplier to be more dynamic; --- examples/Example_Usage.md | 2 ++ src/dsd_ncurses.c | 6 ++++++ src/dsd_symbol.c | 1 + src/edacs-fme.c | 3 +++ src/m17.c | 2 ++ src/rtl_sdr_fm.cpp | 5 ++--- 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/examples/Example_Usage.md b/examples/Example_Usage.md index 9db5f3e..c59fd76 100644 --- a/examples/Example_Usage.md +++ b/examples/Example_Usage.md @@ -214,6 +214,8 @@ V - Toggle Low Pass Filter on Analog Voice or Raw Signal Monitoring B - Toggle High Pass Filter on Analog Voice or Raw Signal Monitoring N - Toggle Passband Filter on Analog Voice or Raw Signal Monitoring +v - Cycle RTL Input Volume Multiplier 1X, 2X, 3X (lower v) + ``` ## Sending Audio to a Icecast 2 Server via FFmpeg (Windows) diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index 510d1cc..ec898cc 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -4602,6 +4602,12 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) } + if (c == 118 && opts->audio_in_type == 3) //'v' key, cycle rtl volume multiplier, when active + { + if (opts->rtl_volume_multiplier == 1 || opts->rtl_volume_multiplier == 2) opts->rtl_volume_multiplier++; + else opts->rtl_volume_multiplier = 1; + } + if (c == 86) // 'V' Key, toggle LPF { if (opts->use_lpf == 0) opts->use_lpf = 1; diff --git a/src/dsd_symbol.c b/src/dsd_symbol.c index 46b4e9b..c66c07a 100644 --- a/src/dsd_symbol.c +++ b/src/dsd_symbol.c @@ -133,6 +133,7 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync) cleanupAndExit(opts, state); //update root means square power level opts->rtl_rms = rtl_return_rms(); + sample *= opts->rtl_volume_multiplier; #endif } diff --git a/src/edacs-fme.c b/src/edacs-fme.c index e6b59c8..7a3afd7 100644 --- a/src/edacs-fme.c +++ b/src/edacs-fme.c @@ -208,18 +208,21 @@ void edacs_analog(dsd_opts * opts, dsd_state * state, int afs, unsigned char lcn for (i = 0; i < 960; i++) { get_rtlsdr_sample(&sample, opts, state); + sample *= opts->rtl_volume_multiplier; analog1[i] = sample; } for (i = 0; i < 960; i++) { get_rtlsdr_sample(&sample, opts, state); + sample *= opts->rtl_volume_multiplier; analog2[i] = sample; } for (i = 0; i < 960; i++) { get_rtlsdr_sample(&sample, opts, state); + sample *= opts->rtl_volume_multiplier; analog3[i] = sample; } //the rtl rms value works properly without needing a 'hard' squelch value diff --git a/src/m17.c b/src/m17.c index 89dd6a3..88832c0 100644 --- a/src/m17.c +++ b/src/m17.c @@ -1847,6 +1847,7 @@ void encodeM17STR(dsd_opts * opts, dsd_state * state) for (j = 0; j < dec; j++) if (get_rtlsdr_sample(&sample, opts, state) < 0) cleanupAndExit(opts, state); + sample *= opts->rtl_volume_multiplier; voice1[i] = sample; } @@ -1855,6 +1856,7 @@ void encodeM17STR(dsd_opts * opts, dsd_state * state) for (j = 0; j < dec; j++) if (get_rtlsdr_sample(&sample, opts, state) < 0) cleanupAndExit(opts, state); + sample *= opts->rtl_volume_multiplier; voice2[i] = sample; } diff --git a/src/rtl_sdr_fm.cpp b/src/rtl_sdr_fm.cpp index 2762d47..ad04667 100644 --- a/src/rtl_sdr_fm.cpp +++ b/src/rtl_sdr_fm.cpp @@ -1027,6 +1027,7 @@ void open_rtlsdr_stream(dsd_opts *opts) int r; rtl_bandwidth = opts->rtl_bandwidth * 1000; //reverted back to straight value bandwidth_multiplier = (bandwidth_divisor / rtl_bandwidth); + volume_multiplier = 1; //moved to external handling to be more dynamic //this needs to be initted first, then we set the parameters dongle_init(&dongle); @@ -1057,9 +1058,7 @@ void open_rtlsdr_stream(dsd_opts *opts) if (opts->rtl_udp_port != 0) port = opts->rtl_udp_port; //set this here, only open socket thread if set if (opts->rtl_gain_value > 0) { dongle.gain = opts->rtl_gain_value * 10; //multiple by ten to make it consitent with the way rtl_fm works - } - volume_multiplier = opts->rtl_volume_multiplier; - // fprintf (stderr, "Setting RTL Volume Multiplier to %d\n", volume_multiplier); + } /* quadruple sample_rate to limit to Δθ to ±π/2 */ demod.rate_in *= demod.post_downsample;