RTL/NCURSES - Clear Queue and Dibit Buffer; #125
This commit is contained in:
parent
5c8e3d95a7
commit
6a0b1b2dcf
|
|
@ -1055,6 +1055,7 @@ bool QR_16_7_6_decode(unsigned char *rxBits);
|
|||
|
||||
void InitAllFecFunction(void);
|
||||
void resetState (dsd_state * state);
|
||||
void reset_dibit_buffer(dsd_state * state);
|
||||
void dstar_header_decode(dsd_state * state, int radioheaderbuffer[660]);
|
||||
|
||||
//P25 PDU Handler
|
||||
|
|
@ -1113,6 +1114,7 @@ void get_rtlsdr_sample(int16_t *sample, dsd_opts * opts, dsd_state * state);
|
|||
void rtlsdr_sighandler();
|
||||
void rtl_dev_tune(dsd_opts * opts, long int frequency);
|
||||
int rtl_return_rms();
|
||||
void rtl_clean_queue();
|
||||
#endif
|
||||
//DMR TRELLIS
|
||||
void CDMRTrellisTribitsToBits(const unsigned char* tribits, unsigned char* payload);
|
||||
|
|
|
|||
|
|
@ -1415,7 +1415,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
|||
//Preamble plus FSW, proceed right away
|
||||
if ( (strncmperr (synctest19, NXDN_PANDFSW, 19, 1) == 0) )
|
||||
{
|
||||
// state->carrier = 1;
|
||||
state->carrier = 1;
|
||||
state->offset = synctest_pos;
|
||||
state->max = ((state->max) + lmax) / 2;
|
||||
state->min = ((state->min) + lmin) / 2;
|
||||
|
|
@ -1428,7 +1428,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
else if ( (strncmperr (synctest19, INV_NXDN_PANDFSW, 19, 1) == 0) )
|
||||
{
|
||||
// state->carrier = 1;
|
||||
state->carrier = 1;
|
||||
state->offset = synctest_pos;
|
||||
state->max = ((state->max) + lmax) / 2;
|
||||
state->min = ((state->min) + lmin) / 2;
|
||||
|
|
@ -1441,7 +1441,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
else if ( (strncmperr (synctest10, NXDN_FSW, 10, 1) == 0) )
|
||||
{
|
||||
// state->carrier = 1;
|
||||
state->carrier = 1;
|
||||
state->offset = synctest_pos;
|
||||
state->max = ((state->max) + lmax) / 2;
|
||||
state->min = ((state->min) + lmin) / 2;
|
||||
|
|
@ -1459,7 +1459,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
else if ( (strncmperr (synctest10, INV_NXDN_FSW, 10, 1) == 0) )
|
||||
{
|
||||
// state->carrier = 1;
|
||||
state->carrier = 1;
|
||||
state->offset = synctest_pos;
|
||||
state->max = ((state->max) + lmax) / 2;
|
||||
state->min = ((state->min) + lmin) / 2;
|
||||
|
|
|
|||
|
|
@ -1357,7 +1357,7 @@ main (int argc, char **argv)
|
|||
}
|
||||
|
||||
#ifdef AERO_BUILD
|
||||
fprintf (stderr, "Build Version: v2.0.1-13 Win32 \n");
|
||||
fprintf (stderr, "Build Version: v2.0.1-14 Win32 \n");
|
||||
#else
|
||||
fprintf (stderr, "Build Version: %s \n", GIT_TAG);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -407,6 +407,13 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
|||
closePulseInput(opts);
|
||||
}
|
||||
|
||||
if (opts->audio_in_type == 3)
|
||||
{
|
||||
#ifdef USE_RTLSDR
|
||||
rtl_clean_queue();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (opts->audio_in_type == 8) //close TCP input SF file so we don't buffer audio while not decoding
|
||||
{
|
||||
sf_close(opts->tcp_file_in);
|
||||
|
|
@ -1658,6 +1665,8 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
|||
opts->rtl_started = 1; //set here so ncurses terminal doesn't attempt to open it again
|
||||
open_rtlsdr_stream(opts);
|
||||
}
|
||||
rtl_clean_queue();
|
||||
reset_dibit_buffer(state); //test and observe for any random issues, disable if needed
|
||||
#elif AERO_BUILD
|
||||
opts->audio_out_type = 3; //hopefully the audio stream is still/already open
|
||||
#else
|
||||
|
|
@ -2063,7 +2072,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||
if (opts->ncurses_compact == 1)
|
||||
{
|
||||
printw ("------------------------------------------------------------------------------\n");
|
||||
printw ("| Digital Speech Decoder: Florida Man Edition - Aero \n", "v2.0.1-13 Win32");
|
||||
printw ("| Digital Speech Decoder: Florida Man Edition - Aero \n", "v2.0.1-14 Win32");
|
||||
printw ("------------------------------------------------------------------------------\n");
|
||||
}
|
||||
#elif LIMAZULUTWEAKS
|
||||
|
|
@ -2092,7 +2101,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||
if (i == 4) printw (" MBElib %s", versionstr);
|
||||
#ifdef AERO_BUILD
|
||||
if (i == 5) printw (" %s ", "Aero Win32");
|
||||
if (i == 6) printw (" v2.0.1-13 Win32 \n");
|
||||
if (i == 6) printw (" v2.0.1-14 Win32 \n");
|
||||
#else
|
||||
if (i == 5) printw (" %s ", "zDEV BUILD");
|
||||
if (i == 6) printw (" %s \n", GIT_TAG);
|
||||
|
|
|
|||
|
|
@ -120,3 +120,15 @@ void resetState (dsd_state * state)
|
|||
initialize_p25_heuristics(&state->p25_heuristics);
|
||||
initialize_p25_heuristics(&state->inv_p25_heuristics);
|
||||
}
|
||||
|
||||
//simple function to reset the dibit buffer
|
||||
void reset_dibit_buffer(dsd_state * state)
|
||||
{
|
||||
//Dibit Buffer -- Free Allocated Memory
|
||||
free (state->dibit_buf);
|
||||
|
||||
//Dibit Buffer -- Memset/Init/Allocate Memory
|
||||
state->dibit_buf = malloc (sizeof (int) * 1000000);
|
||||
state->dibit_buf_p = state->dibit_buf + 200;
|
||||
memset (state->dibit_buf, 0, sizeof (int) * 200);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1094,6 +1094,8 @@ void rtl_dev_tune(dsd_opts * opts, long int frequency)
|
|||
dongle.freq = opts->rtlsdr_center_freq = frequency;
|
||||
optimal_settings(dongle.freq, demod.rate_in);
|
||||
r = verbose_set_frequency(dongle.dev, dongle.freq);
|
||||
rtl_clean_queue();
|
||||
|
||||
}
|
||||
|
||||
//return RMS value (root means square) power level -- used as soft squelch inside of framesync
|
||||
|
|
@ -1102,4 +1104,12 @@ int rtl_return_rms()
|
|||
int sr = 0;
|
||||
sr = rms(demod.lowpassed, demod.lp_len, 1);
|
||||
return (sr);
|
||||
}
|
||||
|
||||
//simple function to clear the rtl sample queue when tuning and during other events (ncurses menu open/close)
|
||||
void rtl_clean_queue()
|
||||
{
|
||||
//insert method to clear the entire queue to prevent sample 'lag'
|
||||
std::queue<int16_t> empty; //create an empty queue
|
||||
std::swap( output.queue, empty ); //swap in empty queue to effectively zero out current queue
|
||||
}
|
||||
Loading…
Reference in New Issue