Default Smoothing Off; Upsample 8k Audio to 48k;

This commit is contained in:
lwvmobile
2022-12-26 09:37:37 -05:00
parent c02d7c0ba0
commit eeb6924369
2 changed files with 56 additions and 76 deletions

View File

@@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------------
* dsd_ncurses.c
* A dsd ncurses terminal printer with menu system
* DSD-FME ncurses terminal printer with menu system
*
* ASCII art generated by:
* https://fsymbols.com/generators/carty/
@@ -8,22 +8,6 @@
* LWVMOBILE
* 2022-08 DSD-FME Florida Man Edition
*-----------------------------------------------------------------------------*/
/*
* Copyright (C) 2010 DSD Author
* GPG Key ID: 0x3F1D7FD0 (74EF 430D F7F2 0A48 FCE6 F630 FAA2 635D 3F1D 7FD0)
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "dsd.h"
#include "git_ver.h"
@@ -67,15 +51,15 @@ unsigned long long int call_matrix[33][6];
char * FM_bannerN[9] = {
" Press 'q' to quit ESC or Arrow Keys For Menu ",
" ██████╗ ██████╗██████╗    ███████╗███╗ ███╗███████╗ ",
" ██╔══██╗██╔════╝██╔══██╗   ██╔════╝████╗ ████║██╔════╝ ",
" ██║ ██║╚█████╗ ██║ ██║   █████╗ ██╔████╔██║█████╗ ",
" ██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ",
" ██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗ ",
" ╚═════╝ ╚═════╝ ╚═════╝    ╚═╝ ╚═╝ ╚═╝╚══════╝ ",
" ",
" "
" Press 'q' to quit ESC or Arrow Keys For Menu ",
" ██████╗ ██████╗██████╗    ███████╗███╗ ███╗███████╗ ",
" ██╔══██╗██╔════╝██╔══██╗   ██╔════╝████╗ ████║██╔════╝ ",
" ██║ ██║╚█████╗ ██║ ██║   █████╗ ██╔████╔██║█████╗ ",
" ██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ",
" ██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗ ",
" ╚═════╝ ╚═════╝ ╚═════╝    ╚═╝ ╚═╝ ╚═╝╚══════╝ ",
" ",
" "
};
@@ -137,14 +121,14 @@ char * DMRBusrtTypes[32] = {
"IDLE ",
"R1_D ",
"ERR ",
"DUID ERR ",
"R-S ERR ",
"CRC ERR ",
"NULL ",
"Voice ", //Using 16 for Voice since its higher than possible value in DMR
" ", //17 is assigned on start up
"INIT ",
"INIT ",//expanded to include P1/2 signalling
"DUID ERR ",
"R-S ERR ",
"CRC ERR ",
"NULL ",
"Voice ",
" ",
"INIT ",
"INIT ",
"MAC PTT", //20
"MAC ACTIVE", //21
"MAC HANGTIME", //22
@@ -1078,7 +1062,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 1;
opts->frame_x2tdma = 1;
@@ -1108,7 +1092,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 0;
opts->frame_x2tdma = 0;
@@ -1136,7 +1120,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 1;
opts->frame_x2tdma = 0;
@@ -1169,7 +1153,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 0;
opts->frame_x2tdma = 0;
@@ -1229,7 +1213,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 1;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 0;
opts->frame_x2tdma = 0;
@@ -1256,7 +1240,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 0;
opts->frame_x2tdma = 0;
@@ -1286,7 +1270,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 0;
opts->frame_x2tdma = 0;
@@ -1313,7 +1297,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->dmr_mono = 0;
opts->dmr_stereo = 0; //this value is the end user option
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
opts->pulse_digi_rate_out = 8000;
opts->pulse_digi_rate_out = 48000;
opts->pulse_digi_out_channels = 1;
opts->frame_dstar = 0;
opts->frame_x2tdma = 0;
@@ -1979,21 +1963,17 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
}
if (opts->ncurses_compact == 0)
{
attron(COLOR_PAIR(6)); //6
for (short int i = 0; i < 7; i++)
attron(COLOR_PAIR(6));
for (short int i = 1; i < 7; i++)
{
printw("%s \n", FM_bannerN[i]);
printw("%s", FM_bannerN[i]);
if (i == 1) printw (" ESC to Menu");
if (i == 2) printw (" 'q' to Quit ");
if (i == 5) printw (" MBElib %s", versionstr);
if (i == 6) printw (" %s \n", GIT_TAG);
else printw ("\n");
}
//printw (" https://github.com/lwvmobile/dsd-fme/tree/pulseaudio\n");
printw (" DEV BUILD - May contain changes and broken features\n");
printw (" Github Build Version: %s \n", GIT_TAG);
attroff(COLOR_PAIR(6)); //6
// printw ("--Build Info------------------------------------------------------------------\n");
// printw ("| https://github.com/lwvmobile/dsd-fme/tree/pulseaudio\n"); //http link
// printw ("| Digital Speech Decoder: Florida Man Edition\n");
// printw ("| Github Build Version: %s \n", GIT_TAG);
// printw ("| MBElib version %s\n", versionstr);
// printw ("------------------------------------------------------------------------------\n");
attron(COLOR_PAIR(4));
}
@@ -2033,8 +2013,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->audio_out_type == 0)
{
printw ("| Pulse Audio Output: [%2i] kHz [%i] Channel", opts->pulse_digi_rate_out/1000, opts->pulse_digi_out_channels);
if (state->audio_smoothing == 1 && opts->pulse_digi_rate_out != 8000) printw (" Smoothing On");
if (state->audio_smoothing == 0 && opts->pulse_digi_rate_out != 8000) printw (" Smoothing Off");
if (state->audio_smoothing == 1) printw (" - Smoothing On");
printw (" \n");
}
if (opts->monitor_input_audio == 1)
@@ -2083,6 +2062,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
{
attron(COLOR_PAIR(3));
level = (int) state->max / 164; //only update on carrier present
if (opts->mod_qpsk == 1) (int) state->max / (164*2); //test values here
reset = 1;
}
if (state->carrier == 0 && opts->reset_state == 1 && reset == 1)