CLI Options for Audio Filtering;

This commit is contained in:
lwvmobile 2024-04-01 13:11:23 -04:00
parent fe9b5b51e8
commit dc1bb6a55e
3 changed files with 31 additions and 22 deletions

View File

@ -810,7 +810,7 @@ typedef struct
//Remus DMR End Call Alert Beep
int dmr_end_alert[2]; //dmr TLC end call alert beep has already played once flag
//Upsampled Audio Smoothing
//Bitmap Filtering Options
uint8_t audio_smoothing;
//YSF Fusion Call Strings and Info

View File

@ -805,7 +805,7 @@ initState (dsd_state * state)
//dmr buffer end
state->repeat = 0;
//Upsampled Audio Smoothing
//Bitmap Filtering Options
state->audio_smoothing = 0;
memset (state->audio_out_temp_buf, 0.0f, sizeof(state->audio_out_temp_buf));
@ -1302,6 +1302,8 @@ usage ()
// 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");
printf (" -v <hex> Set Filtering Bitmap Options (Advanced Option)\n");
printf (" 1 1 1 1 (0xF): PBF/LPF/HPF/HPFD on\n");
printf ("\n");
printf ("RTL-SDR options:\n");
printf (" Usage: rtl:dev:freq:gain:ppm:bw:sq:vol\n");
@ -1785,10 +1787,10 @@ 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 -- Perm Disable?
// case 'V':
// state.audio_smoothing = 1;
// break;
case 'V':
sscanf (optarg, "%d", &slotson);
@ -1886,13 +1888,26 @@ main (int argc, char **argv)
state.symbolCenter = state.symbolCenter * opts.wav_interpolator;
break;
// case 'v':
// sscanf (optarg, "%d", &opts.verbose);
// break;
case 'v': //set filters via bitmap values 0b1111
sscanf (optarg, "%X", &state.audio_smoothing);
if (state.audio_smoothing & 1) opts.use_hpf_d = 1;
else opts.use_hpf_d = 0;
// case 'n': //disable or reclaim?
// state.use_throttle = 1;
// break;
if (state.audio_smoothing & 2) opts.use_hpf = 1;
else opts.use_hpf = 0;
if (state.audio_smoothing & 4) opts.use_lpf = 1;
else opts.use_lpf = 0;
if (state.audio_smoothing & 8) opts.use_pbf = 1;
else opts.use_pbf = 0;
if (opts.use_hpf_d == 1) fprintf (stderr, "High Pass Filter on Digital Enabled\n");
if (opts.use_hpf == 1) fprintf (stderr, "High Pass Filter on Analog Enabled\n");
if (opts.use_lpf == 1) fprintf (stderr, "Low Pass Filter on Analog Enabled\n");
if (opts.use_pbf == 1) fprintf (stderr, "Pass Band Filter on Analog Enabled\n");
break;
case 'b': //formerly Capital 'K'
sscanf (optarg, "%lld", &state.K);
@ -2840,7 +2855,7 @@ main (int argc, char **argv)
if (opts.tcp_sockfd != 0)
{
opts.audio_in_type = 8;
state.audio_smoothing = 0; //disable smoothing to prevent random crackling/buzzing
fprintf (stderr, "TCP Connection Success!\n");
// openAudioInDevice(&opts); //do this to see if it makes it work correctly
}

View File

@ -951,7 +951,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
}
state->audio_smoothing = 0; //disable smoothing to prevent random crackling/buzzing
TCP_END: ; //do nothing
@ -2420,7 +2420,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->audio_gain > 0) printw (" (+|-) Manual");
if (opts->use_hpf_d == 1) printw (" HPF");
if (opts->call_alert == 1) printw (" *CA!"); //Call Alert
// if (state->audio_smoothing == 1 && opts->floating_point == 0) printw (" Smoothing On;"); //only on short
printw (" \n");
}
@ -2444,7 +2444,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->audio_gain > 0) printw (" (+/-) Manual");
if (opts->use_hpf_d == 1) printw (" HPF");
if (opts->call_alert == 1) printw (" *CA!"); //Call Alert
// if (state->audio_smoothing == 1 && opts->floating_point == 0) printw (" Smoothing On;"); //only on short
if ( (opts->audio_out_type == 5 && opts->pulse_digi_rate_out == 48000 && opts->pulse_digi_out_channels == 1) && (opts->frame_provoice == 1 || opts->monitor_input_audio == 1) )
printw (" - Monitor RMS: %04ld ", opts->rtl_rms);
printw (" \n");
@ -4327,12 +4327,6 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
}
// if (c == 48) //'0' key, toggle upsampled audio smoothing
// {
// if (state->audio_smoothing == 1) state->audio_smoothing = 0;
// else state->audio_smoothing = 1;
// }
if (opts->p25_trunk == 1 && c == 119) //'w' key, toggle white list/black list mode
{
if (opts->trunk_use_allow_list == 1) opts->trunk_use_allow_list = 0;