More Work/Tweaks on AGF and Ncurses Gain Control;

This commit is contained in:
lwvmobile 2023-08-02 22:48:17 -04:00
parent d826391d16
commit e59b46448a
4 changed files with 37 additions and 17 deletions

View File

@ -287,8 +287,7 @@ processAudio (dsd_opts * opts, dsd_state * state)
// copy audio data to output buffer and upsample if necessary
state->audio_out_temp_buf_p = state->audio_out_temp_buf;
//we only want to upsample when using sample rates greater than 8k for output,
//hard set to 8k for RTL mono and MBE playback, otherwise crackling may occur.
//we only want to upsample when using sample rates greater than 8k for output
if (opts->pulse_digi_rate_out > 8000)
{
for (n = 0; n < 160; n++)
@ -436,7 +435,6 @@ processAudioR (dsd_opts * opts, dsd_state * state)
// copy audio data to output buffer and upsample if necessary
state->audio_out_temp_buf_pR = state->audio_out_temp_bufR;
//we only want to upsample when using sample rates greater than 8k for output,
//hard set to 8k for RTL mono and MBE playback, otherwise crackling may occur.
if (opts->pulse_digi_rate_out > 8000)
{
for (n = 0; n < 160; n++)

View File

@ -879,7 +879,8 @@ void soft_tonef (float samp[160], int n, int ID, int AD)
}
//older version, does better at normalizing audio, but also sounds 'flatter' and 'muddier'
//probably too much compression and adjustments on the sine wave
//probably too much compression and adjustments on the samples
//Remus, enable this one and disable the one above if you prefer
// void agf (dsd_opts * opts, dsd_state * state, float samp[160], int slot)
// {
// int i, j, run;
@ -891,7 +892,13 @@ void soft_tonef (float samp[160], int n, int ID, int AD)
// float mmin = -0.75f;
// float aavg = 0.0f; //average of the absolute value
// float df; //decimation value
// df = 3276.7f; //test value -- this would be the ideal perfect value if everybody spoke directly into the mic at a reasonable volume
// df = 3277.0f; //test value
// //trying things
// float gain = 1.0f;
// if (opts->audio_gain != 0)
// gain = opts->audio_gain / 25.0f;
// //this comparison is to determine whether or not to run gain on 'empty' samples (2v last 2, silent frames, etc)
// if (memcmp(empty, samp, sizeof(empty)) == 0) run = 0;
@ -910,6 +917,8 @@ void soft_tonef (float samp[160], int n, int ID, int AD)
// samp[(j*20)+i] = samp[(j*20)+i] / df;
// samp[(j*20)+i] *= gain * 0.75f;
// aavg += fabsf(samp[i]);
// //simple clipping

View File

@ -857,8 +857,8 @@ initState (dsd_state * state)
state->firstframe = 0;
sprintf (state->slot1light, "%s", "");
sprintf (state->slot2light, "%s", "");
state->aout_gain = 10;
state->aout_gainR = 10;
state->aout_gain = 25.0f;
state->aout_gainR = 25.0f;
memset (state->aout_max_buf, 0, sizeof (float) * 200);
state->aout_max_buf_p = state->aout_max_buf;
state->aout_max_buf_idx = 0;
@ -1346,7 +1346,7 @@ liveScanner (dsd_opts * opts, dsd_state * state)
if (opts->floating_point == 1)
{
// opts->audio_gain /= 2.0f;
if (opts->audio_gain > 50.0f) opts->audio_gain = 50.0f;
if (opts->audio_gain < 0.0f) opts->audio_gain = 0.0f;
}

View File

@ -2299,23 +2299,28 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->rtl_udp_port != 0) printw ("\n| External Tuning on UDP Port: %i", opts->rtl_udp_port);
printw ("\n");
}
if (opts->audio_out_type == 0)
{
printw ("| Pulse Audio Output: %i kHz; %i Channel; G: %.1f%%", opts->pulse_digi_rate_out/1000, opts->pulse_digi_out_channels, state->aout_gain*2);
if (opts->pulse_digi_out_channels == 2) printw (" G: %.1f%%", state->aout_gainR*2);
if (state->audio_smoothing == 1 && opts->floating_point == 0) printw (" Smoothing On;"); //only on short
if (opts->floating_point == 1) printw (" Floating Point;");
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);
if (opts->pulse_digi_out_channels == 2) printw (" G: %02.0f%%", state->aout_gainR*2);
if (opts->floating_point == 1) printw (" FBG: %02.0f%%;", opts->audio_gain*2);
if (opts->audio_gain == 0) printw (" (+/-) Auto");
if (opts->audio_gain > 0) printw (" (+/-) Manual");
// if (state->audio_smoothing == 1 && opts->floating_point == 0) printw (" Smoothing On;"); //only on short
printw (" \n");
}
if (opts->audio_out_type == 5 || opts->audio_out_type == 2)
{
printw ("| OSS Audio Output: %i kHz; %i Channel; G: %.1f%%", opts->pulse_digi_rate_out/1000, opts->pulse_digi_out_channels, state->aout_gain*2);
if (opts->pulse_digi_out_channels == 2) printw (" G: %.1f%%", state->aout_gainR*2);
if (state->audio_smoothing == 1 && opts->floating_point == 0) printw (" Smoothing On;"); //nly on short
if (opts->floating_point == 1) printw (" Floating Point;");
printw ("| OSS Audio 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->audio_gain == 0) printw (" (+/-) Auto");
if (opts->audio_gain > 0) printw (" (+/-) Manual");
// if (state->audio_smoothing == 1 && opts->floating_point == 0) printw (" Smoothing On;"); //only on short
printw (" \n");
}
if (opts->monitor_input_audio == 1)
{
printw ("| Monitoring Source Audio when Carrier Present and No Sync Detected\n");
@ -3543,6 +3548,14 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
state->aout_gain = opts->audio_gain;
state->aout_gainR = opts->audio_gain;
//reset to default on 0 for auto
if (opts->audio_gain == 0)
{
state->aout_gain = 25;
state->aout_gainR = 25;
}
}
if (c == 122) //'z' key, toggle payload to console