From 3bb99945892f71cea41f59143153809326ce39a6 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Fri, 28 Jul 2023 20:53:56 -0400 Subject: [PATCH] Tweak Toggle Voice Synthesis for FDMA Sources; --- examples/Example_Usage.md | 4 ++-- src/dsd_audio.c | 15 +++++++++++++++ src/dsd_audio2.c | 8 ++++++++ src/dsd_main.c | 7 ++++--- src/dsd_ncurses.c | 6 +++--- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/examples/Example_Usage.md b/examples/Example_Usage.md index 72f06e0..add9fd0 100644 --- a/examples/Example_Usage.md +++ b/examples/Example_Usage.md @@ -180,8 +180,8 @@ p - stop per call decoded wav files (Lower p) t - toggle trunking (needs either rtl input, or rigctl connection) y - toggle scanner (needs either rtl input, or rigctl connection) 0 - Toggle Audio Smoothing - May produce crackling if enabled on RTL/TCP or wav/bin files -1 - Toggle Voice Synthesis in TDMA Slot 1 (DMR and P25) -2 - Toggle Voice Synthesis in TDMA Slot 2 (DMR and P25) +1 - Toggle Voice Synthesis in TDMA Slot 1 or FDMA Conventional Voice +2 - Toggle Voice Synthesis in TDMA Slot 2 w - Toggle Trunking/Playback White List (Allow A Groups Only) / Black List (Block B or DE groups only) Mode g - Toggle Trunking Tuning to Group Calls (DMR T3, Con+, Cap+, P25, NXDN) u - Toggle Trunking Tuning to Private Calls (DMR T3, Cap+, P25) diff --git a/src/dsd_audio.c b/src/dsd_audio.c index 46fa644..c2cb7c7 100644 --- a/src/dsd_audio.c +++ b/src/dsd_audio.c @@ -456,6 +456,19 @@ playSynthesizedVoice (dsd_opts * opts, dsd_state * state) ssize_t result; UNUSED(result); + //don't synthesize voice if slot is turned off + if (opts->slot1_on == 0) + { + //clear any previously buffered audio + state->audio_out_float_buf_p = state->audio_out_float_buf + 100; + state->audio_out_buf_p = state->audio_out_buf + 100; + memset (state->audio_out_float_buf, 0, 100 * sizeof (float)); + memset (state->audio_out_buf, 0, 100 * sizeof (short)); + state->audio_out_idx2 = 0; + state->audio_out_idx = 0; + goto end_psv; + } + if (state->audio_out_idx > opts->delay) { if (opts->audio_out_type == 5) //OSS @@ -474,6 +487,8 @@ playSynthesizedVoice (dsd_opts * opts, dsd_state * state) } + end_psv: + if (state->audio_out_idx2 >= 800000) { state->audio_out_float_buf_p = state->audio_out_float_buf + 100; diff --git a/src/dsd_audio2.c b/src/dsd_audio2.c index 7b75b81..c5f84c3 100644 --- a/src/dsd_audio2.c +++ b/src/dsd_audio2.c @@ -409,6 +409,8 @@ void playSynthesizedVoiceFS (dsd_opts * opts, dsd_state * state) //TODO: add option to bypass enc with a toggle as well + if (opts->slot1_on == 0) encL = 1; + //run autogain on the f_ buffers agf (opts, state, state->f_l,0); @@ -477,12 +479,16 @@ void playSynthesizedVoiceFM (dsd_opts * opts, dsd_state * state) agf(opts, state, state->f_l,0); + if (opts->slot1_on == 0) goto vfm_end; + if (opts->audio_out_type == 0) pa_simple_write(opts->pulse_digi_dev_out, state->f_l, 160*4, NULL); if (opts->audio_out_type == 1 || opts->audio_out_type == 5) write(opts->audio_out_fd, state->f_l, 160*4); + vfm_end: + if (state->audio_out_idx2 >= 800000) { state->audio_out_float_buf_p = state->audio_out_float_buf + 100; @@ -512,6 +518,8 @@ void playSynthesizedVoiceSS (dsd_opts * opts, dsd_state * state) //TODO: add option to bypass enc with a toggle as well + if (opts->slot1_on == 0) encL = 1; + //interleave left and right channels from the short storage area for (i = 0; i < 160; i++) { diff --git a/src/dsd_main.c b/src/dsd_main.c index 16b5601..6ce02fc 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -97,6 +97,8 @@ unsigned long long int p2vars = 0; char * pEnd; //bugfix +int slotson = 3; + void noCarrier (dsd_opts * opts, dsd_state * state) { @@ -1525,9 +1527,9 @@ main (int argc, char **argv) } #ifdef AERO_BUILD - fprintf (stderr, "Build Version: v2.1c (20230720)\n"); + fprintf (stderr, "Build Version: AW (WIP) \n"); #else - fprintf (stderr, "Build Version: %s \n", GIT_TAG); + fprintf (stderr, "Build Version: AW (WIP) %s \n", GIT_TAG); #endif fprintf (stderr,"MBElib Version: %s\n", versionstr); @@ -1635,7 +1637,6 @@ main (int argc, char **argv) // break; case 'V': - int slotson = 3; sscanf (optarg, "%d", &slotson); if (slotson > 3) slotson = 3; opts.slot1_on = (slotson & 1) >> 0; diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index d04c4ba..32f99ff 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -2251,12 +2251,12 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) if (i == 4) printw (" MBElib %s", versionstr); #ifdef AERO_BUILD if (i == 5) printw (" %s ", "Aero Build"); - if (i == 6) printw (" v2.1c (20230720) \n"); + if (i == 6) printw (" AW (WIP) \n"); #elif ZDEV_BUILD - if (i == 5) printw (" %s ", "Audio WIP "); + if (i == 5) printw (" %s ", "AW (WIP)"); if (i == 6) printw (" %s \n", GIT_TAG); #else - if (i == 5) printw (" %s ", "Audio WIP"); + if (i == 5) printw (" %s ", "AW (WIP)"); if (i == 6) printw (" %s \n", GIT_TAG); #endif else printw ("\n");