resetState and Minor Ncurses Printer tweak
resetState and Minor Ncurses Printer tweak don't run with -n yet, resets state, using to test to fix when input type changes, but won't decode properly
This commit is contained in:
parent
9acff308b9
commit
417a48cc71
|
|
@ -238,6 +238,7 @@ typedef struct
|
|||
pa_simple *pulse_digi_dev_in;
|
||||
pa_simple *pulse_digi_dev_out;
|
||||
int use_ncurses_terminal;
|
||||
int reset_state;
|
||||
|
||||
} dsd_opts;
|
||||
|
||||
|
|
@ -535,6 +536,7 @@ void NxdnEncryptionStreamGeneration (dsd_opts* opts, dsd_state* state, uint8_t K
|
|||
void processMbeFrameEncrypted (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char ambe_fr[4][24], char imbe7100_fr[7][24], char ambe_keystream[49], char imbe_keystream[88]);
|
||||
//end borrow from LEH
|
||||
|
||||
void resetState (dsd_state * state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -193,7 +193,12 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
playRawAudio(opts, state); //this is on line 21 in dsd_audio.c
|
||||
}
|
||||
|
||||
/*
|
||||
if (opts->reset_state == 1 && state->carrier == 0)
|
||||
{
|
||||
resetState (state);
|
||||
}
|
||||
*/
|
||||
t++;
|
||||
symbol = getSymbol (opts, state, 0);
|
||||
|
||||
|
|
@ -1020,6 +1025,12 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
|||
fprintf (stderr,"Press CTRL + C to close.\n"); //Kindly remind user to double tap CTRL + C
|
||||
}
|
||||
noCarrier (opts, state);
|
||||
/*
|
||||
if (opts->reset_state == 1)
|
||||
{
|
||||
resetState (state);
|
||||
}
|
||||
*/
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -764,8 +764,9 @@ main (int argc, char **argv)
|
|||
}
|
||||
break;
|
||||
case 'n':
|
||||
opts.audio_out = 0;
|
||||
fprintf (stderr,"Disabling audio output to soundcard.\n");
|
||||
//opts.audio_out = 0;
|
||||
//fprintf (stderr,"Disabling audio output to soundcard.\n");
|
||||
opts.reset_state = 1;
|
||||
break;
|
||||
case 'w':
|
||||
strncpy(opts.wav_out_file, optarg, 1023);
|
||||
|
|
|
|||
|
|
@ -274,14 +274,16 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||
attron(COLOR_PAIR(3));
|
||||
level = (int) state->max / 164; //only update on carrier present
|
||||
}
|
||||
//if (state->carrier == 0){ //figure out method that will tell me when is active and when not active, maybe carrier but this doesn't print anyways unless activity
|
||||
//attron(COLOR_PAIR(1));
|
||||
//0 - sync type; 1 - tg/ran; 2 - rid; 3 - slot; 4 - dcc; 5 - time(NULL) ;
|
||||
//}
|
||||
if (state->carrier == 0 && opts->reset_state == 1)
|
||||
{
|
||||
resetState (state);
|
||||
}
|
||||
|
||||
|
||||
printw ("--Audio Decode----------------------------------------------------------------\n");
|
||||
printw ("| In Level: [%3i%%] \n", level);
|
||||
printw ("| Voice Error: [%i][%i] \n| Error Bars: [%s] \n", state->errs, state->errs2, state->err_str); //
|
||||
printw ("| Carrier = %i\n", state->carrier);
|
||||
printw ("------------------------------------------------------------------------------\n");
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,107 @@
|
|||
|
||||
#include "dsd.h"
|
||||
#include "p25p1_heuristics.h"
|
||||
|
||||
void
|
||||
resetState (dsd_state * state)
|
||||
{
|
||||
|
||||
int i, j;
|
||||
|
||||
state->dibit_buf = malloc (sizeof (int) * 1000000);
|
||||
state->dibit_buf_p = state->dibit_buf + 200;
|
||||
memset (state->dibit_buf, 0, sizeof (int) * 200);
|
||||
state->repeat = 0; //not sure yet
|
||||
//state->audio_out_buf = malloc (sizeof (short) * 1000000);
|
||||
//memset (state->audio_out_buf, 0, 100 * sizeof (short));
|
||||
//state->audio_out_buf_p = state->audio_out_buf + 100;
|
||||
//state->audio_out_float_buf = malloc (sizeof (float) * 1000000);
|
||||
//memset (state->audio_out_float_buf, 0, 100 * sizeof (float));
|
||||
//state->audio_out_float_buf_p = state->audio_out_float_buf + 100;
|
||||
//state->audio_out_idx = 0;
|
||||
//state->audio_out_idx2 = 0;
|
||||
//state->audio_out_temp_buf_p = state->audio_out_temp_buf;
|
||||
//state->wav_out_bytes = 0;
|
||||
state->center = 0;
|
||||
state->jitter = -1;
|
||||
state->synctype = -1;
|
||||
state->min = -15000;
|
||||
state->max = 15000;
|
||||
state->lmid = 0;
|
||||
state->umid = 0;
|
||||
state->minref = -12000;
|
||||
state->maxref = 12000;
|
||||
state->lastsample = 0;
|
||||
for (i = 0; i < 128; i++)
|
||||
{
|
||||
state->sbuf[i] = 0;
|
||||
}
|
||||
state->sidx = 0;
|
||||
for (i = 0; i < 1024; i++)
|
||||
{
|
||||
state->maxbuf[i] = 15000;
|
||||
}
|
||||
for (i = 0; i < 1024; i++)
|
||||
{
|
||||
state->minbuf[i] = -15000;
|
||||
}
|
||||
state->midx = 0;
|
||||
state->err_str[0] = 0;
|
||||
sprintf (state->fsubtype, " ");
|
||||
sprintf (state->ftype, " ");
|
||||
state->symbolcnt = 0;
|
||||
state->rf_mod = 0;
|
||||
state->numflips = 0;
|
||||
state->lastsynctype = -1;
|
||||
state->lastp25type = 0;
|
||||
state->offset = 0;
|
||||
state->carrier = 0;
|
||||
for (i = 0; i < 25; i++)
|
||||
{
|
||||
for (j = 0; j < 16; j++)
|
||||
{
|
||||
state->tg[i][j] = 48;
|
||||
}
|
||||
}
|
||||
state->tgcount = 0;
|
||||
state->lasttg = 0;
|
||||
state->lastsrc = 0;
|
||||
state->nac = 0;
|
||||
state->errs = 0;
|
||||
state->errs2 = 0;
|
||||
state->mbe_file_type = -1;
|
||||
state->optind = 0;
|
||||
state->numtdulc = 0;
|
||||
state->firstframe = 0;
|
||||
sprintf (state->slot0light, " slot0 ");
|
||||
sprintf (state->slot1light, " slot1 ");
|
||||
state->aout_gain = 25;
|
||||
memset (state->aout_max_buf, 0, sizeof (float) * 200);
|
||||
state->aout_max_buf_p = state->aout_max_buf;
|
||||
state->aout_max_buf_idx = 0;
|
||||
state->samplesPerSymbol = 10;
|
||||
state->symbolCenter = 4;
|
||||
sprintf (state->algid, "________");
|
||||
sprintf (state->keyid, "________________");
|
||||
state->currentslot = 0;
|
||||
state->cur_mp = malloc (sizeof (mbe_parms));
|
||||
state->prev_mp = malloc (sizeof (mbe_parms));
|
||||
state->prev_mp_enhanced = malloc (sizeof (mbe_parms));
|
||||
mbe_initMbeParms (state->cur_mp, state->prev_mp, state->prev_mp_enhanced);
|
||||
state->p25kid = 0;
|
||||
|
||||
state->debug_audio_errors = 0;
|
||||
state->debug_header_errors = 0;
|
||||
state->debug_header_critical_errors = 0;
|
||||
|
||||
state->nxdn_last_ran = 0;
|
||||
|
||||
//#ifdef TRACE_DSD
|
||||
// state->debug_sample_index = 0;
|
||||
// state->debug_label_file = NULL;
|
||||
// state->debug_label_dibit_file = NULL;
|
||||
// state->debug_label_imbe_file = NULL;
|
||||
//#endif
|
||||
|
||||
initialize_p25_heuristics(&state->p25_heuristics); //see if we want to re-init this or not
|
||||
}
|
||||
Loading…
Reference in New Issue