Analog Gain Has Own Variable; Ncurses Keys; Misc;

This commit is contained in:
lwvmobile
2024-03-21 10:12:04 -04:00
parent 0debcc647e
commit eadf3fdf23
4 changed files with 26 additions and 10 deletions

View File

@@ -260,6 +260,7 @@ typedef struct
FILE *symbol_out_f;
float audio_gain;
float audio_gainR;
float audio_gainA;
int audio_out;
int dmr_stereo_wav;
char wav_out_dir[512];

View File

@@ -1425,7 +1425,7 @@ void analog_gain (dsd_opts * opts, dsd_state * state, short * input, int len)
int i;
UNUSED(state);
float gain = 1.0f + (opts->audio_gain / 25.0f);
float gain = (opts->audio_gainA / 100.0f) * 3.0f; //scale 0x - 3x
for (i = 0; i < len; i++)
input[i] *= gain;

View File

@@ -583,6 +583,7 @@ initOpts (dsd_opts * opts)
opts->mbe_out_fR = NULL; //second slot on a TDMA system
opts->audio_gain = 0;
opts->audio_gainR = 0;
opts->audio_gainA = 50.0f; //scale of 1 - 100
opts->audio_out = 1;
opts->wav_out_file[0] = 0;
opts->wav_out_fileR[0] = 0;
@@ -2023,6 +2024,7 @@ main (int argc, char **argv)
case 'g':
sscanf (optarg, "%f", &opts.audio_gain);
opts.audio_gainA = opts.audio_gain; //straight assignment
if (opts.audio_gain < (float) 0 )
{
fprintf (stderr,"Disabling audio out gain setting\n");

View File

@@ -2334,7 +2334,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
printw ("--Input Output----------------------------------------------------------------\n");
if (opts->audio_in_type == 0)
{
printw ("| Pulse Audio Input: %i kHz; %i Channel; ", opts->pulse_digi_rate_in/1000, opts->pulse_digi_in_channels);
printw ("| Pulse Signal Input: %i kHz; %i Ch; ", opts->pulse_digi_rate_in/1000, opts->pulse_digi_in_channels);
if (opts->use_rigctl == 1)
printw ("RIG: %s:%d; ", opts->tcp_hostname, opts->rigctlportno);
printw ("\n");
@@ -2342,7 +2342,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->audio_in_type == 5)
{
printw ("| OSS Audio Input: %i kHz; 1 Channel;", SAMPLE_RATE_IN/1000);
printw ("| OSS Signal Input: %i kHz; 1 Ch;", SAMPLE_RATE_IN/1000);
if (opts->use_rigctl == 1)
printw ("RIG: %s:%d; ", opts->tcp_hostname, opts->rigctlportno);
printw ("\n");
@@ -2355,7 +2355,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->audio_in_type == 8)
{
printw ("| TCP Audio Input: %s:%d; %d kHz 1 Channel; ", opts->tcp_hostname, opts->tcp_portno, opts->wav_sample_rate/1000);
printw ("| TCP Signal Input: %s:%d; %d kHz; 1 Ch; ", opts->tcp_hostname, opts->tcp_portno, opts->wav_sample_rate/1000);
if (opts->use_rigctl == 1)
printw ("RIG: %s:%d; ", opts->tcp_hostname, opts->rigctlportno);
printw ("\n");
@@ -2390,11 +2390,11 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->audio_out_type == 0)
{
printw ("| Pulse Audio Output: %i kHz; %i Ch; G: %02.0f%%", opts->pulse_digi_rate_out/1000, opts->pulse_digi_out_channels, state->aout_gain*2);
printw ("| Pulse Digital Output: %i kHz; %i Ch; G: %02.0f%%", opts->pulse_digi_rate_out/1000, opts->pulse_digi_out_channels, state->aout_gain*2);
if (opts->pulse_digi_out_channels == 2) printw (" G: %02.0f%%", state->aout_gainR*2);
if (opts->floating_point == 1) printw (" FLOAT: %02.0f%%;", opts->audio_gain*2);
if (opts->audio_gain == 0) printw (" (+/-) Auto");
if (opts->audio_gain > 0) printw (" (+/-) Manual");
if (opts->audio_gain == 0) printw (" (+|-) Auto");
if (opts->audio_gain > 0) printw (" (+|-) Manual");
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");
@@ -2402,7 +2402,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if ( opts->audio_out_type == 0 && (opts->frame_provoice == 1 || opts->monitor_input_audio == 1) )
{
printw ("| Pulse Audio Output: %i kHz; %i Ch; Analog Monitor RMS: %04ld ", opts->pulse_raw_rate_out/1000, opts->pulse_raw_out_channels, opts->rtl_rms);
printw ("| Pulse Analog Output: %i kHz; %i Ch; G: %02.0f%% (/|*) Manual", opts->pulse_raw_rate_out/1000, opts->pulse_raw_out_channels, opts->audio_gainA);
if (opts->audio_in_type != 3) printw (" RMS: %04ld;", opts->rtl_rms);
printw (" \n");
}
@@ -2421,7 +2422,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->audio_out_type == 8)
{
printw ("| UDP Audio Output: %s:%d; %d kHz %d Ch; %02.0f%%", opts->udp_hostname, opts->udp_portno, opts->pulse_digi_rate_out/1000, opts->pulse_digi_out_channels, state->aout_gain*2);
printw ("| UDP Digital Output: %s:%d; %d kHz %d Ch; %02.0f%%", opts->udp_hostname, opts->udp_portno, opts->pulse_digi_rate_out/1000, opts->pulse_digi_out_channels, state->aout_gain*2);
if (opts->pulse_digi_out_channels == 2) printw (" G: %02.0f%%", state->aout_gainR*2);
if (opts->audio_gain == 0) printw (" (+/-) Auto");
if (opts->audio_gain > 0) printw (" (+/-) Manual");
@@ -2431,7 +2432,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
printw (" \n");
if (opts->udp_sockfdA != 0) //Analog Output on udp port +2
{
printw ("| UDP Audio Output: %s:%d; 48 kHz 1 Ch; Analog Output; ", opts->udp_hostname, opts->udp_portno+2);
printw ("| UDP Analog Output: %s:%d; 48 kHz 1 Ch; Analog Output; ", opts->udp_hostname, opts->udp_portno+2);
printw (" \n");
}
}
@@ -3745,6 +3746,18 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
}
if (c == 42) // * key, increment audio_gainA
{
if (opts->audio_gainA < 100)
opts->audio_gainA++;
}
if (c == 47) // / key, decrement audio_gainA
{
if (opts->audio_gainA > 0)
opts->audio_gainA--;
}
if (c == 122) //'z' key, toggle payload to console
{
if (opts->payload == 1) opts->payload = 0;