diff --git a/examples/Example_Usage.md b/examples/Example_Usage.md index a6c20fc..72f06e0 100644 --- a/examples/Example_Usage.md +++ b/examples/Example_Usage.md @@ -179,9 +179,9 @@ P - start per call decoded wav files (Capital P) 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) -1 - Lockout Tuning/Playback of TG in Slot 1 or Conventional -- Current Session Only if no group.csv file specified -2 - Lockout Tuning/Playback of TG in Slot 2 -- Current Session Only if no group.csv file specified 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) 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) @@ -191,4 +191,7 @@ e - Toggle Trunking Tuning to Encrypted Calls (P25) 9 - Connect to SDR++ RIGCTL Server with Defaults/Retry RIGCTL Connection D - Reset DMR Site Parms/Call Strings, etc. Z - Simulate NoCarrier/No VC/CC sync (capital Z) + +! - Lockout Tuning/Playback of TG in Slot 1 or Conventional -- Current Session Only if no group.csv file specified +@ - Lockout Tuning/Playback of TG in Slot 2 -- Current Session Only if no group.csv file specified ``` \ No newline at end of file diff --git a/include/dsd.h b/include/dsd.h index 2e9f9f3..e0de6d7 100644 --- a/include/dsd.h +++ b/include/dsd.h @@ -389,9 +389,13 @@ typedef struct //Trunking - Tune Enc Calls (P25 only on applicable grants with svc opts) uint8_t trunk_tune_enc_calls; - //OSS audio - slot preference + //OSS audio 48k/1 - slot preference int slot_preference; + //hard set slots to synthesize + int slot1_on; + int slot2_on; + //'DSP' Format Output uint8_t use_dsp_output; char dsp_out_file[2048]; diff --git a/src/dsd_audio2.c b/src/dsd_audio2.c index 2cc0f50..b6b8cbb 100644 --- a/src/dsd_audio2.c +++ b/src/dsd_audio2.c @@ -141,6 +141,12 @@ void playSynthesizedVoiceFS3 (dsd_opts * opts, dsd_state * state) //TODO: add option to bypass enc with a toggle as well + //CHEAT: Using the slot on/off, use that to set encL or encR back on + //as a simple way to turn off voice synthesis in a particular slot + //its not really 'disabled', we just aren't playing it + if (opts->slot1_on == 0) encL = 1; + if (opts->slot2_on == 0) encR = 1; + //run autogain on the f_ buffers agf (opts, state, state->f_l4[0],0); agf (opts, state, state->f_r4[0],1); @@ -506,6 +512,12 @@ void playSynthesizedVoiceFS4 (dsd_opts * opts, dsd_state * state) stereo_samp4[i*2+1] = state->f_r4[3][i]; } + //CHEAT: Using the slot on/off, use that to set encL or encR back on + //as a simple way to turn off voice synthesis in a particular slot + //its not really 'disabled', we just aren't playing it + if (opts->slot1_on == 0) encL = 1; + if (opts->slot2_on == 0) encR = 1; + if (encL && encR) goto END_FS4; @@ -987,6 +999,12 @@ void playSynthesizedVoiceSS3 (dsd_opts * opts, dsd_state * state) //TODO: add option to bypass enc with a toggle as well + //CHEAT: Using the slot on/off, use that to set encL or encR back on + //as a simple way to turn off voice synthesis in a particular slot + //its not really 'disabled', we just aren't playing it + if (opts->slot1_on == 0) encL = 1; + if (opts->slot2_on == 0) encR = 1; + //interleave left and right channels from the short storage area for (i = 0; i < 160; i++) { @@ -1119,6 +1137,12 @@ void playSynthesizedVoiceSS4 (dsd_opts * opts, dsd_state * state) //TODO: add option to bypass enc with a toggle as well + //CHEAT: Using the slot on/off, use that to set encL or encR back on + //as a simple way to turn off voice synthesis in a particular slot + //its not really 'disabled', we just aren't playing it + if (opts->slot1_on == 0) encL = 1; + if (opts->slot2_on == 0) encR = 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 4b10be5..bdda14f 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -710,9 +710,13 @@ initOpts (dsd_opts * opts) //OSS audio - Slot Preference //slot preference is used during OSS audio playback to //prefer one tdma voice slot over another when both are playing back - //this is a fix to cygwin stuttering when both slots have voice + //this is a fix to OSS 48k/1 output opts->slot_preference = 0; //default prefer slot 1 -- state->currentslot = 0; + //hardset slots to synthesize + opts->slot1_on = 1; + opts->slot2_on = 1; + //dsp structured file opts->dsp_out_file[0] = 0; opts->use_dsp_output = 0; @@ -1190,7 +1194,8 @@ usage () printf (" -Q Specify Filename for OK-DMRlib Structured File Output. (placed in DSP folder)\n"); printf (" -c Output symbol capture to .bin file\n"); printf (" -q Reverse Mute - Mute Unencrypted Voice and Unmute Encrypted Voice\n"); - printf (" -V Enable Audio Smoothing on Upsampled 48k/1 or 24k/2 Audio (Capital V)\n"); + // printf (" -V Enable Audio Smoothing on Upsampled 48k/1 or 24k/2 Audio (Capital V)\n"); + printf (" -V Enable TDMA Voice Synthesis on Slot 1 (1), Slot 2 (2), or Both (3); Default is 3; \n"); printf (" (Audio Smoothing is now disabled on all upsampled output by default -- fix crackle/buzz bug)\n"); printf (" -z Set TDMA Voice Slot Preference when using /dev/dsp audio output (prevent lag and stuttering)\n"); printf (" -y Enable Experimental Pulse Audio Float Audio Output\n"); @@ -1531,7 +1536,7 @@ main (int argc, char **argv) exitflag = 0; - while ((c = getopt (argc, argv, "yhaepPqs:t:v:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:G:D:L:VU:YK:b:H:X:NQ:WrlZTF01:2:345:6:7:89:Ek:")) != -1) + while ((c = getopt (argc, argv, "yhaepPqs:t:v:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:G:D:L:V:U:YK:b:H:X:NQ:WrlZTF01:2:345:6:7:89:Ek:")) != -1) { opterr = 0; switch (c) @@ -1622,10 +1627,25 @@ main (int argc, char **argv) fprintf (stderr, "TDMA (DMR and P2) Slot Voice Preference is Slot %d. \n", opts.slot_preference+1); break; - //Enable Audio Smoothing for Upsampled Audio + //Enable Audio Smoothing for Upsampled Audio -- Perm Disable? + // case 'V': + // state.audio_smoothing = 1; + // break; + case 'V': - state.audio_smoothing = 1; - break; + int slotson = 3; + sscanf (optarg, "%d", &slotson); + if (slotson > 3) slotson = 3; + opts.slot1_on = (slotson & 1) >> 0; + opts.slot2_on = (slotson & 2) >> 1; + fprintf (stderr, "TDMA Voice Synthesis "); + if (opts.slot1_on == 1) fprintf (stderr, "on Slot 1"); + if (slotson == 3) fprintf (stderr, " and "); + if (opts.slot2_on == 1) fprintf (stderr, "on Slot 2"); + + if (slotson == 0) fprintf (stderr, "Disabled"); + fprintf (stderr, "\n"); + break; //Trunking - Use Group List as Allow List case 'W': diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index b103aba..ada3670 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -2444,8 +2444,12 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) if (opts->dmr_stereo == 1) { - printw ("| Voice ErrS1: [%i][%i] \n", state->errs, state->errs2); - printw ("| Voice ErrS2: [%i][%i] \n", state->errsR, state->errs2R); + printw ("| Voice ErrS1: [%i][%i] Slot 1", state->errs, state->errs2); + if (opts->slot1_on == 0) printw (" OFF"); + printw ("\n"); + printw ("| Voice ErrS2: [%i][%i] Slot 2", state->errsR, state->errs2R); + if (opts->slot2_on == 0) printw (" OFF"); + printw ("\n"); } printw ("------------------------------------------------------------------------------\n"); @@ -3491,6 +3495,36 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) ncursesMenu (opts, state); //just a quick test } + if (c == 49) // '1' key, toggle slot1 on + { + //switching, but want to control each seperately plz + if (opts->slot1_on == 1) + { + opts->slot1_on = 0; + // opts->slot_preference = 1; + } + else if (opts->slot1_on == 0) + { + opts->slot1_on = 1; + // opts->slot_preference = 0; + } + } + + if (c == 50) // '2' key, toggle slot2 on + { + //switching, but want to control each seperately plz + if (opts->slot2_on == 1) + { + opts->slot2_on = 0; + // opts->slot_preference = 1; + } + else if (opts->slot2_on == 0) + { + opts->slot2_on = 1; + // opts->slot_preference = 0; + } + } + if (c == 43) //+ key, increment aout_gain { // if (state->aout_gain < 50) @@ -3738,8 +3772,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) } #endif - //test jumping back to CC on group lockout instead of random frequency to break framesync - if (state->lasttg != 0 && opts->frame_provoice != 1 && c == 49) //'1' key, lockout slot 1 or conventional tg from tuning/playback during session + //makes buzzing sound when locked out in new audio config and short, probably something to do with processaudio running or not running + if (state->lasttg != 0 && opts->frame_provoice != 1 && c == 33) //SHIFT+'1' key (exclamation point), lockout slot 1 or conventional tg from tuning/playback during session { state->group_array[state->group_tally].groupNumber = state->lasttg; sprintf (state->group_array[state->group_tally].groupMode, "%s", "B"); @@ -3794,7 +3828,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) } - if (state->lasttgR != 0 && opts->frame_provoice != 1 && c == 50) //'2' key, lockout slot 2 tdma tgR from tuning/playback during session + if (state->lasttgR != 0 && opts->frame_provoice != 1 && c == 64) //SHIFT+'2' key (@ at sign), lockout slot 2 tdma tgR from tuning/playback during session { state->group_array[state->group_tally].groupNumber = state->lasttgR; sprintf (state->group_array[state->group_tally].groupMode, "%s", "B");