Fix/Restore MBEout Files; 'DSP' CACH; Tweaks;
This commit is contained in:
parent
9f03bbc8a1
commit
dcb21f2cd0
|
|
@ -199,8 +199,10 @@ typedef struct
|
|||
int playoffsetR;
|
||||
char mbe_out_dir[1024];
|
||||
char mbe_out_file[1024];
|
||||
char mbe_out_fileR[1024]; //second slot on a TDMA system
|
||||
char mbe_out_path[2048]; //1024
|
||||
FILE *mbe_out_f;
|
||||
FILE *mbe_out_fR; //second slot on a TDMA system
|
||||
FILE *symbol_out_f;
|
||||
float audio_gain;
|
||||
float audio_gainR;
|
||||
|
|
@ -214,6 +216,7 @@ typedef struct
|
|||
char szNumbers[1024]; //**tera 10/32/64 char str
|
||||
short int symbol_out;
|
||||
short int mbe_out; //flag for mbe out, don't attempt fclose more than once
|
||||
short int mbe_outR; //flag for mbe out, don't attempt fclose more than once
|
||||
SNDFILE *wav_out_f;
|
||||
SNDFILE *wav_out_fR;
|
||||
SNDFILE *wav_out_raw;
|
||||
|
|
@ -350,7 +353,7 @@ typedef struct
|
|||
|
||||
//'DSP' Format Output
|
||||
uint8_t use_dsp_output;
|
||||
char dsp_out_file[1024];
|
||||
char dsp_out_file[2048];
|
||||
|
||||
} dsd_opts;
|
||||
|
||||
|
|
@ -747,16 +750,19 @@ int get_dibit_and_analog_signal (dsd_opts * opts, dsd_state * state, int * out_a
|
|||
void skipDibit (dsd_opts * opts, dsd_state * state, int count);
|
||||
void saveImbe4400Data (dsd_opts * opts, dsd_state * state, char *imbe_d);
|
||||
void saveAmbe2450Data (dsd_opts * opts, dsd_state * state, char *ambe_d);
|
||||
void saveAmbe2450DataR (dsd_opts * opts, dsd_state * state, char *ambe_d); //tdma slot 2
|
||||
void PrintAMBEData (dsd_opts * opts, dsd_state * state, char *ambe_d);
|
||||
void PrintIMBEData (dsd_opts * opts, dsd_state * state, char *imbe_d);
|
||||
int readImbe4400Data (dsd_opts * opts, dsd_state * state, char *imbe_d);
|
||||
int readAmbe2450Data (dsd_opts * opts, dsd_state * state, char *ambe_d);
|
||||
void openMbeInFile (dsd_opts * opts, dsd_state * state);
|
||||
void closeMbeOutFile (dsd_opts * opts, dsd_state * state);
|
||||
void closeMbeOutFileR (dsd_opts * opts, dsd_state * state); //tdma slot 2
|
||||
void openMbeOutFile (dsd_opts * opts, dsd_state * state);
|
||||
void openMbeOutFileR (dsd_opts * opts, dsd_state * state); //tdma slot 2
|
||||
void openWavOutFile (dsd_opts * opts, dsd_state * state);
|
||||
void openWavOutFileL (dsd_opts * opts, dsd_state * state);
|
||||
void openWavOutFileR (dsd_opts * opts, dsd_state * state);
|
||||
void openWavOutFileR (dsd_opts * opts, dsd_state * state);
|
||||
void openWavOutFileRaw (dsd_opts * opts, dsd_state * state);
|
||||
void openSymbolOutFile (dsd_opts * opts, dsd_state * state);
|
||||
void closeSymbolOutFile (dsd_opts * opts, dsd_state * state);
|
||||
|
|
|
|||
34
src/dmr_bs.c
34
src/dmr_bs.c
|
|
@ -263,8 +263,11 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
|
|||
fprintf (stderr,"Sync: +DMR ");
|
||||
}
|
||||
else fprintf (stderr,"Sync: -DMR ");
|
||||
|
||||
|
||||
vc1 = 1;
|
||||
|
||||
//close MBEout file - slot 1
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
}
|
||||
if (internalslot == 1)
|
||||
{
|
||||
|
|
@ -276,6 +279,9 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
vc2 = 1;
|
||||
|
||||
//close MBEout file - slot 2
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
|
||||
}
|
||||
dmr_data_sync (opts, state);
|
||||
skipcount++;
|
||||
|
|
@ -312,12 +318,16 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
|
|||
state->dmrburstL = 16;
|
||||
vc = vc1;
|
||||
sprintf (light, "%s", " [SLOT1] slot2 ");
|
||||
//open MBEout file - slot 1
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) openMbeOutFile (opts, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
state->dmrburstR = 16;
|
||||
vc = vc2;
|
||||
sprintf (light, "%s", " slot1 [SLOT2] ");
|
||||
//open MBEout file - slot 2
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_fR == NULL)) openMbeOutFileR (opts, state);
|
||||
}
|
||||
if (opts->inverted_dmr == 0) sprintf (polarity, "%s", "+");
|
||||
else sprintf (polarity, "%s", "-");
|
||||
|
|
@ -376,6 +386,12 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
FILE * pFile; //file pointer
|
||||
pFile = fopen (opts->dsp_out_file, "a");
|
||||
fprintf (pFile, "\n%d 98 ", internalslot+1); //'98' is CACH designation value
|
||||
for (i = 0; i < 6; i++) //3 byte CACH
|
||||
{
|
||||
int cach_byte = (state->dmr_stereo_payload[i*2] << 2) | state->dmr_stereo_payload[i*2 + 1];
|
||||
fprintf (pFile, "%X", cach_byte);
|
||||
}
|
||||
fprintf (pFile, "\n%d 10 ", internalslot+1); //0x10 for voice burst
|
||||
for (i = 6; i < 72; i++) //33 bytes, no CACH
|
||||
{
|
||||
|
|
@ -421,6 +437,10 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
|
|||
state->errs2R = 0;
|
||||
state->errs2 = 0;
|
||||
|
||||
//close any open MBEout files
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
|
||||
//if we have a tact or emb err, then produce sync pattern/err message
|
||||
if (tact_okay != 1 || emb_ok != 1)
|
||||
{
|
||||
|
|
@ -639,6 +659,12 @@ void dmrBSBootstrap (dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
FILE * pFile; //file pointer
|
||||
pFile = fopen (opts->dsp_out_file, "a");
|
||||
fprintf (pFile, "\n%d 98 ", internalslot+1); //'98' is CACH designation value
|
||||
for (i = 0; i < 6; i++) //3 byte CACH
|
||||
{
|
||||
int cach_byte = (state->dmr_stereo_payload[i*2] << 2) | state->dmr_stereo_payload[i*2 + 1];
|
||||
fprintf (pFile, "%X", cach_byte);
|
||||
}
|
||||
fprintf (pFile, "\n%d 10 ", internalslot+1); //0x10 for "voice burst"
|
||||
for (i = 6; i < 72; i++) //33 bytes, no CACH
|
||||
{
|
||||
|
|
@ -655,10 +681,14 @@ void dmrBSBootstrap (dsd_opts * opts, dsd_state * state)
|
|||
if (state->currentslot == 0)
|
||||
{
|
||||
sprintf (light, "%s", " [SLOT1] slot2 ");
|
||||
//open MBEout file - slot 1
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) openMbeOutFile (opts, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (light, "%s", " slot1 [SLOT2] ");
|
||||
//open MBEout file - slot 2
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_fR == NULL)) openMbeOutFileR (opts, state);
|
||||
}
|
||||
if (opts->inverted_dmr == 0) sprintf (polarity, "%s", "+");
|
||||
else sprintf (polarity, "%s", "-");
|
||||
|
|
@ -696,7 +726,7 @@ void dmrBSBootstrap (dsd_opts * opts, dsd_state * state)
|
|||
fprintf (stderr,"%s ", getTime());
|
||||
fprintf (stderr,"Sync: DMR ");
|
||||
fprintf (stderr, "%s", KRED);
|
||||
fprintf (stderr, "| VOICE CACH/SYNC ERR");
|
||||
fprintf (stderr, "| VOICE TACT/SYNC ERR");
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
//run LFSR if either slot had an active MI in it.
|
||||
if (state->payload_algid >= 0x21)
|
||||
|
|
|
|||
|
|
@ -174,6 +174,12 @@ void dmr_data_burst_handler(dsd_opts * opts, dsd_state * state, uint8_t info[196
|
|||
{
|
||||
FILE * pFile; //file pointer
|
||||
pFile = fopen (opts->dsp_out_file, "a");
|
||||
fprintf (pFile, "\n%d 98 ", slot+1); //'98' is CACH designation value
|
||||
for (i = 0; i < 6; i++) //3 byte CACH
|
||||
{
|
||||
int cach_byte = (state->dmr_stereo_payload[i*2] << 2) | state->dmr_stereo_payload[i*2 + 1];
|
||||
fprintf (pFile, "%X", cach_byte);
|
||||
}
|
||||
fprintf (pFile, "\n%d %02X ", slot+1, databurst); //use hex value of current data burst type
|
||||
for (i = 6; i < 72; i++) //33 bytes, no CACH
|
||||
{
|
||||
|
|
|
|||
235
src/dsd_file.c
235
src/dsd_file.c
|
|
@ -45,8 +45,7 @@ char * getDateF(void) {
|
|||
return curr2;
|
||||
}
|
||||
|
||||
void
|
||||
saveImbe4400Data (dsd_opts * opts, dsd_state * state, char *imbe_d)
|
||||
void saveImbe4400Data (dsd_opts * opts, dsd_state * state, char *imbe_d)
|
||||
{
|
||||
int i, j, k;
|
||||
unsigned char b;
|
||||
|
|
@ -56,36 +55,22 @@ saveImbe4400Data (dsd_opts * opts, dsd_state * state, char *imbe_d)
|
|||
fputc (err, opts->mbe_out_f);
|
||||
|
||||
k = 0;
|
||||
if (opts->payload == 1) //make opt variable later on to toggle this
|
||||
{
|
||||
//fprintf(stderr, "\n IMBE ");
|
||||
}
|
||||
|
||||
for (i = 0; i < 11; i++)
|
||||
{
|
||||
b = 0;
|
||||
{
|
||||
b = 0;
|
||||
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
b = b << 1;
|
||||
b = b + imbe_d[k];
|
||||
k++;
|
||||
}
|
||||
if (opts->payload == 1) //make opt variable later on to toggle this
|
||||
{
|
||||
//fprintf (stderr, "%02X", b);
|
||||
}
|
||||
fputc (b, opts->mbe_out_f);
|
||||
}
|
||||
if (opts->payload == 1)
|
||||
{
|
||||
//fprintf(stderr, " err = [%X] [%X] ", state->errs, state->errs2);
|
||||
}
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
b = b << 1;
|
||||
b = b + imbe_d[k];
|
||||
k++;
|
||||
}
|
||||
fputc (b, opts->mbe_out_f);
|
||||
}
|
||||
fflush (opts->mbe_out_f);
|
||||
}
|
||||
|
||||
void
|
||||
saveAmbe2450Data (dsd_opts * opts, dsd_state * state, char *ambe_d)
|
||||
void saveAmbe2450Data (dsd_opts * opts, dsd_state * state, char *ambe_d)
|
||||
{
|
||||
int i, j, k;
|
||||
unsigned char b;
|
||||
|
|
@ -95,42 +80,49 @@ saveAmbe2450Data (dsd_opts * opts, dsd_state * state, char *ambe_d)
|
|||
fputc (err, opts->mbe_out_f);
|
||||
|
||||
k = 0;
|
||||
if (opts->payload == 1) //make opt variable later on to toggle this
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
//fprintf(stderr, "\n AMBE ");
|
||||
b = 0;
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
b = b << 1;
|
||||
b = b + ambe_d[k];
|
||||
k++;
|
||||
}
|
||||
fputc (b, opts->mbe_out_f);
|
||||
}
|
||||
//for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < 6; i++) //using 7 seems to break older amb files where it was 6, need to test 7 on 7 some more
|
||||
{
|
||||
b = 0;
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
b = b << 1;
|
||||
b = b + ambe_d[k];
|
||||
k++;
|
||||
}
|
||||
if (opts->payload == 1 && i < 6) //make opt variable later on to toggle this
|
||||
{
|
||||
//fprintf (stderr, "%02X", b);
|
||||
}
|
||||
if (opts->payload == 1 && i == 6) //7th octet should only contain 1 bit? value will be either 0x00 or 0x80?
|
||||
{
|
||||
//fprintf (stderr, "%02X", b & 0x80); //7th octet should only contain 1 bit?
|
||||
}
|
||||
|
||||
fputc (b, opts->mbe_out_f);
|
||||
}
|
||||
if (opts->payload == 1)
|
||||
{
|
||||
//fprintf(stderr, " err = [%X] [%X] ", state->errs, state->errs2);
|
||||
}
|
||||
b = ambe_d[48];
|
||||
fputc (b, opts->mbe_out_f);
|
||||
fflush (opts->mbe_out_f);
|
||||
}
|
||||
|
||||
void
|
||||
PrintIMBEData (dsd_opts * opts, dsd_state * state, char *imbe_d) //for P25P1 and ProVoice
|
||||
void saveAmbe2450DataR (dsd_opts * opts, dsd_state * state, char *ambe_d)
|
||||
{
|
||||
int i, j, k;
|
||||
unsigned char b;
|
||||
unsigned char err;
|
||||
|
||||
err = (unsigned char) state->errs2R;
|
||||
fputc (err, opts->mbe_out_fR);
|
||||
|
||||
k = 0;
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
b = 0;
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
b = b << 1;
|
||||
b = b + ambe_d[k];
|
||||
k++;
|
||||
}
|
||||
fputc (b, opts->mbe_out_fR);
|
||||
}
|
||||
b = ambe_d[48];
|
||||
fputc (b, opts->mbe_out_fR);
|
||||
fflush (opts->mbe_out_fR);
|
||||
}
|
||||
|
||||
void PrintIMBEData (dsd_opts * opts, dsd_state * state, char *imbe_d) //for P25P1 and ProVoice
|
||||
{
|
||||
int i, j, k;
|
||||
unsigned char b;
|
||||
|
|
@ -165,8 +157,7 @@ PrintIMBEData (dsd_opts * opts, dsd_state * state, char *imbe_d) //for P25P1 and
|
|||
//fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
PrintAMBEData (dsd_opts * opts, dsd_state * state, char *ambe_d)
|
||||
void PrintAMBEData (dsd_opts * opts, dsd_state * state, char *ambe_d)
|
||||
{
|
||||
int i, j, k;
|
||||
unsigned char b;
|
||||
|
|
@ -333,14 +324,21 @@ openMbeInFile (dsd_opts * opts, dsd_state * state)
|
|||
cookie[2] = fgetc (opts->mbe_in_f);
|
||||
cookie[3] = fgetc (opts->mbe_in_f);
|
||||
cookie[4] = 0;
|
||||
//ambe+2
|
||||
if (strstr (cookie, ".amb") != NULL)
|
||||
{
|
||||
state->mbe_file_type = 1;
|
||||
}
|
||||
{
|
||||
state->mbe_file_type = 1;
|
||||
}
|
||||
//p1 and pv
|
||||
else if (strstr (cookie, ".imb") != NULL)
|
||||
{
|
||||
state->mbe_file_type = 0;
|
||||
}
|
||||
{
|
||||
state->mbe_file_type = 0;
|
||||
}
|
||||
//d-star ambe
|
||||
else if (strstr (cookie, ".dmb") != NULL)
|
||||
{
|
||||
state->mbe_file_type = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->mbe_file_type = -1;
|
||||
|
|
@ -349,7 +347,7 @@ openMbeInFile (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
}
|
||||
|
||||
//much simpler version
|
||||
//slot 1
|
||||
void closeMbeOutFile (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
if (opts->mbe_out == 1)
|
||||
|
|
@ -360,48 +358,67 @@ void closeMbeOutFile (dsd_opts * opts, dsd_state * state)
|
|||
fclose (opts->mbe_out_f);
|
||||
opts->mbe_out_f = NULL;
|
||||
opts->mbe_out = 0;
|
||||
fprintf (stderr, "\nClosing MBE out file.");
|
||||
fprintf (stderr, "\nClosing MBE out file 1.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
openMbeOutFile (dsd_opts * opts, dsd_state * state)
|
||||
//slot 2
|
||||
void closeMbeOutFileR (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
if (opts->mbe_outR == 1)
|
||||
{
|
||||
if (opts->mbe_out_fR != NULL)
|
||||
{
|
||||
fflush (opts->mbe_out_fR);
|
||||
fclose (opts->mbe_out_fR);
|
||||
opts->mbe_out_fR = NULL;
|
||||
opts->mbe_outR = 0;
|
||||
fprintf (stderr, "\nClosing MBE out file 2.\n");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void openMbeOutFile (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
|
||||
int i, j;
|
||||
char ext[5];
|
||||
|
||||
if ((state->synctype == 0) || (state->synctype == 1) || (state->synctype == 14) || (state->synctype == 15))
|
||||
{
|
||||
sprintf (ext, ".imb");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (ext, ".amb");
|
||||
}
|
||||
//phase 1 and provoice
|
||||
if ( (state->synctype == 0) || (state->synctype == 1) || (state->synctype == 14) || (state->synctype == 15) )
|
||||
{
|
||||
sprintf (ext, ".imb");
|
||||
}
|
||||
//d-star
|
||||
else if ( (state->synctype == 6) || (state->synctype == 7) || (state->synctype == 18) || (state->synctype == 19) )
|
||||
{
|
||||
sprintf (ext, ".dmb"); //new dstar file extension to make it read in and process properly
|
||||
}
|
||||
//dmr, nxdn, phase 2, x2-tdma
|
||||
else sprintf (ext, ".amb");
|
||||
|
||||
// reset talkgroup id buffer
|
||||
//reset talkgroup id buffer
|
||||
for (i = 0; i < 12; i++)
|
||||
{
|
||||
for (j = 0; j < 25; j++)
|
||||
{
|
||||
for (j = 0; j < 25; j++)
|
||||
{
|
||||
state->tg[j][i] = 0;
|
||||
}
|
||||
state->tg[j][i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
state->tgcount = 0;
|
||||
|
||||
sprintf (opts->mbe_out_file, "%s %s%s", getDateF(), getTimeF(), ext);
|
||||
sprintf (opts->mbe_out_file, "%s %s S1%s", getDateF(), getTimeF(), ext);
|
||||
|
||||
sprintf (opts->mbe_out_path, "%s%s", opts->mbe_out_dir, opts->mbe_out_file);
|
||||
|
||||
opts->mbe_out_f = fopen (opts->mbe_out_path, "w");
|
||||
if (opts->mbe_out_f == NULL)
|
||||
{
|
||||
fprintf (stderr,"Error, couldn't open %s\n", opts->mbe_out_path);
|
||||
fprintf (stderr,"\nError, couldn't open %s for slot 1\n", opts->mbe_out_path);
|
||||
}
|
||||
else opts->mbe_out = 1;
|
||||
|
||||
|
|
@ -411,8 +428,54 @@ openMbeOutFile (dsd_opts * opts, dsd_state * state)
|
|||
fflush (opts->mbe_out_f);
|
||||
}
|
||||
|
||||
void
|
||||
openWavOutFile (dsd_opts * opts, dsd_state * state)
|
||||
void openMbeOutFileR (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
|
||||
int i, j;
|
||||
char ext[5];
|
||||
|
||||
//phase 1 and provoice
|
||||
if ( (state->synctype == 0) || (state->synctype == 1) || (state->synctype == 14) || (state->synctype == 15) )
|
||||
{
|
||||
sprintf (ext, ".imb");
|
||||
}
|
||||
//d-star
|
||||
else if ( (state->synctype == 6) || (state->synctype == 7) || (state->synctype == 18) || (state->synctype == 19) )
|
||||
{
|
||||
sprintf (ext, ".dmb"); //new dstar file extension to make it read in and process properly
|
||||
}
|
||||
//dmr, nxdn, phase 2, x2-tdma
|
||||
else sprintf (ext, ".amb");
|
||||
|
||||
//reset talkgroup id buffer
|
||||
for (i = 0; i < 12; i++)
|
||||
{
|
||||
for (j = 0; j < 25; j++)
|
||||
{
|
||||
state->tg[j][i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
state->tgcount = 0;
|
||||
|
||||
sprintf (opts->mbe_out_fileR, "%s %s S2%s", getDateF(), getTimeF(), ext);
|
||||
|
||||
sprintf (opts->mbe_out_path, "%s%s", opts->mbe_out_dir, opts->mbe_out_fileR);
|
||||
|
||||
opts->mbe_out_fR = fopen (opts->mbe_out_path, "w");
|
||||
if (opts->mbe_out_fR == NULL)
|
||||
{
|
||||
fprintf (stderr,"\nError, couldn't open %s for slot 2\n", opts->mbe_out_path);
|
||||
}
|
||||
else opts->mbe_outR = 1;
|
||||
|
||||
//
|
||||
fprintf (opts->mbe_out_fR, "%s", ext);
|
||||
|
||||
fflush (opts->mbe_out_fR);
|
||||
}
|
||||
|
||||
void openWavOutFile (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
|
||||
SF_INFO info;
|
||||
|
|
|
|||
445
src/dsd_frame.c
445
src/dsd_frame.c
|
|
@ -87,8 +87,8 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
//NXDN FSW
|
||||
if ((state->synctype == 28) || (state->synctype == 29))
|
||||
{
|
||||
nxdn_frame (opts, state);
|
||||
//no MBEout...use symbol capture bin instead!
|
||||
//MBEout restored, is not handled internally by nxdn_frame.c
|
||||
nxdn_frame (opts, state);
|
||||
return;
|
||||
}
|
||||
else if ((state->synctype == 6) || (state->synctype == 7))
|
||||
|
|
@ -107,7 +107,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
state->nac = 0;
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL))
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
openMbeOutFile (opts, state); //dstar ambe files are read back incorrectly, need to change file extension to differentiate when doing a playback
|
||||
}
|
||||
sprintf (state->fsubtype, " VOICE ");
|
||||
processDSTAR (opts, state);
|
||||
|
|
@ -128,9 +128,9 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
}
|
||||
state->nac = 0;
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL))
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
{
|
||||
openMbeOutFile (opts, state); //dstar ambe files are read back incorrectly, need to change file extension to differentiate when doing a playback
|
||||
}
|
||||
sprintf (state->fsubtype, " DATA ");
|
||||
processDSTAR_HD (opts, state);
|
||||
return;
|
||||
|
|
@ -164,70 +164,58 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
//disable so radio id doesn't blink in and out during ncurses and aggressive_framesync
|
||||
state->nac = 0;
|
||||
//state->lastsrc = 0;
|
||||
//state->lasttg = 0;
|
||||
//state->lastsrcR = 0;
|
||||
//state->lasttgR = 0;
|
||||
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
if (opts->verbose > 0)
|
||||
{
|
||||
if (opts->verbose > 0)
|
||||
{
|
||||
level = (int) state->max / 164;
|
||||
//fprintf (stderr,"inlvl: %2i%% ", level);
|
||||
}
|
||||
level = (int) state->max / 164;
|
||||
//fprintf (stderr,"inlvl: %2i%% ", level);
|
||||
}
|
||||
}
|
||||
if ( (state->synctype == 11) || (state->synctype == 12) || (state->synctype == 32) ) //DMR Voice Modes
|
||||
{
|
||||
|
||||
sprintf (state->fsubtype, " VOICE ");
|
||||
if (opts->dmr_stereo == 0 && state->synctype < 32) // -T option for DMR (TDMA) stereo
|
||||
{
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL) && opts->dmr_stereo == 0)
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
sprintf (state->fsubtype, " VOICE ");
|
||||
if (opts->dmr_stereo == 0 && state->synctype < 32) // -T option for DMR (TDMA) stereo
|
||||
{
|
||||
sprintf (state->slot1light, " slot1 ");
|
||||
sprintf (state->slot2light, " slot2 ");
|
||||
dmrMSBootstrap (opts, state);
|
||||
}
|
||||
if (opts->dmr_mono == 1 && state->synctype == 32)
|
||||
{
|
||||
// fprintf (stderr, "%s", KRED);
|
||||
// fprintf (stderr, "Please use XDMA or DMR Stereo to decode MS/Simplex \n");
|
||||
// fprintf (stderr, "%s", KNRM);
|
||||
dmrMSBootstrap (opts, state);
|
||||
}
|
||||
if (opts->dmr_stereo == 1) //opts->dmr_stereo == 1
|
||||
{
|
||||
state->dmr_stereo = 1; //set the state to 1 when handling pure voice frames
|
||||
if (state->synctype > 31 )
|
||||
{
|
||||
dmrMSBootstrap (opts, state); //bootstrap into MS Bootstrap (voice only)
|
||||
}
|
||||
else dmrBSBootstrap (opts, state); //bootstrap into BS Bootstrap
|
||||
}
|
||||
sprintf (state->slot1light, " slot1 ");
|
||||
sprintf (state->slot2light, " slot2 ");
|
||||
//we can safely open MBE on any MS or mono handling
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) openMbeOutFile (opts, state);
|
||||
dmrMSBootstrap (opts, state);
|
||||
}
|
||||
if (opts->dmr_mono == 1 && state->synctype == 32)
|
||||
{
|
||||
//we can safely open MBE on any MS or mono handling
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) openMbeOutFile (opts, state);
|
||||
dmrMSBootstrap (opts, state);
|
||||
}
|
||||
if (opts->dmr_stereo == 1) //opts->dmr_stereo == 1
|
||||
{
|
||||
state->dmr_stereo = 1; //set the state to 1 when handling pure voice frames
|
||||
if (state->synctype > 31 )
|
||||
{
|
||||
//we can safely open MBE on any MS or mono handling
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) openMbeOutFile (opts, state);
|
||||
dmrMSBootstrap (opts, state); //bootstrap into MS Bootstrap (voice only)
|
||||
}
|
||||
else dmrBSBootstrap (opts, state); //bootstrap into BS Bootstrap
|
||||
}
|
||||
}
|
||||
else if ( (state->synctype == 33) || (state->synctype == 34) ) //MS Data and RC data
|
||||
{
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
dmrMSData (opts, state);
|
||||
// if (opts->dmr_stereo == 0)
|
||||
// {
|
||||
// closeMbeOutFile (opts, state);
|
||||
// state->err_str[0] = 0;
|
||||
// fprintf (stderr, "%s", KRED);
|
||||
// fprintf (stderr, "Please use XDMA or DMR Stereo to decode MS/Simplex \n");
|
||||
// fprintf (stderr, "%s", KNRM);
|
||||
// }
|
||||
// if (opts->dmr_stereo == 1)
|
||||
// {
|
||||
// dmrMSData (opts, state);
|
||||
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (opts->dmr_stereo == 0)
|
||||
{
|
||||
closeMbeOutFile (opts, state);
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
|
||||
state->err_str[0] = 0;
|
||||
sprintf (state->slot1light, " slot1 ");
|
||||
sprintf (state->slot2light, " slot2 ");
|
||||
|
|
@ -237,6 +225,9 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
//switch dmr_stereo to 0 when handling BS data frame syncs with processDMRdata
|
||||
if (opts->dmr_stereo == 1)
|
||||
{
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
|
||||
state->dmr_stereo = 0; //set the state to zero for handling pure data frames
|
||||
sprintf (state->slot1light, " slot1 ");
|
||||
sprintf (state->slot2light, " slot2 ");
|
||||
|
|
@ -246,7 +237,8 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
}
|
||||
return;
|
||||
}
|
||||
else if ((state->synctype >= 2) && (state->synctype <= 5))
|
||||
//X2-TDMA
|
||||
else if ((state->synctype >= 2) && (state->synctype <= 5))
|
||||
{
|
||||
state->nac = 0;
|
||||
if (opts->errorbars == 1)
|
||||
|
|
@ -256,15 +248,15 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
if ((state->synctype == 3) || (state->synctype == 4))
|
||||
{
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL))
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
sprintf (state->fsubtype, " VOICE ");
|
||||
processX2TDMAvoice (opts, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
closeMbeOutFile (opts, state);
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
state->err_str[0] = 0;
|
||||
processX2TDMAdata (opts, state);
|
||||
}
|
||||
|
|
@ -272,21 +264,18 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
}
|
||||
else if ((state->synctype == 14) || (state->synctype == 15))
|
||||
{
|
||||
//state->nac = 0;
|
||||
//state->lastsrc = 0;
|
||||
//state->lasttg = 0;
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
if (opts->verbose > 0)
|
||||
{
|
||||
if (opts->verbose > 0)
|
||||
{
|
||||
level = (int) state->max / 164;
|
||||
//fprintf (stderr,"inlvl: %2i%% ", level);
|
||||
}
|
||||
level = (int) state->max / 164;
|
||||
//fprintf (stderr,"inlvl: %2i%% ", level);
|
||||
}
|
||||
}
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL))
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
sprintf (state->fsubtype, " VOICE ");
|
||||
processProVoice (opts, state);
|
||||
return;
|
||||
|
|
@ -294,6 +283,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
//edacs
|
||||
else if ((state->synctype == 37) || (state->synctype == 38))
|
||||
{
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
edacs (opts, state);
|
||||
return;
|
||||
}
|
||||
|
|
@ -313,13 +303,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
//P25 P2
|
||||
else if ((state->synctype == 35) || (state->synctype == 36))
|
||||
{
|
||||
//Do stuff
|
||||
//fprintf(stderr, "YSF Sync! \n");
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL))
|
||||
{
|
||||
//openMbeOutFile (opts, state);
|
||||
}
|
||||
//sprintf(state->fsubtype, " VOICE ");
|
||||
//relocate MBEout to inside frame handling
|
||||
processP2(opts, state);
|
||||
return;
|
||||
}
|
||||
|
|
@ -328,6 +312,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
/* dPMR Frame Sync 1 */
|
||||
fprintf(stderr, "dPMR Frame Sync 1 ");
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
}
|
||||
else if ((state->synctype == 21) || (state->synctype == 25))
|
||||
{
|
||||
|
|
@ -346,12 +331,12 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
}
|
||||
state->nac = 0;
|
||||
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL))
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
sprintf(state->fsubtype, " VOICE ");
|
||||
processdPMRvoice (opts, state);
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL))
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
sprintf(state->fsubtype, " VOICE ");
|
||||
processdPMRvoice (opts, state);
|
||||
|
||||
return;
|
||||
|
||||
|
|
@ -360,11 +345,13 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
/* dPMR Frame Sync 3 */
|
||||
fprintf(stderr, "dPMR Frame Sync 3 ");
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
}
|
||||
else if ((state->synctype == 23) || (state->synctype == 27))
|
||||
{
|
||||
/* dPMR Frame Sync 4 */
|
||||
fprintf(stderr, "dPMR Frame Sync 4 ");
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
}
|
||||
//dPMR
|
||||
else //P25
|
||||
|
|
@ -463,15 +450,15 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
// Header Data Unit
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," HDU\n");
|
||||
}
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," HDU\n");
|
||||
}
|
||||
if (opts->mbe_out_dir[0] != 0)
|
||||
{
|
||||
closeMbeOutFile (opts, state);
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
{
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
if (opts->mbe_out_f == NULL) openMbeOutFile (opts, state);
|
||||
}
|
||||
mbe_initMbeParms (state->cur_mp, state->prev_mp, state->prev_mp_enhanced);
|
||||
state->lastp25type = 2;
|
||||
state->dmrburstL = 25;
|
||||
|
|
@ -483,17 +470,17 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
// Logical Link Data Unit 1
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," LDU1 ");
|
||||
}
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," LDU1 ");
|
||||
}
|
||||
if (opts->mbe_out_dir[0] != 0)
|
||||
{
|
||||
if (opts->mbe_out_f == NULL)
|
||||
{
|
||||
if (opts->mbe_out_f == NULL)
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
}
|
||||
state->lastp25type = 1;
|
||||
state->dmrburstL = 26;
|
||||
state->currentslot = 0;
|
||||
|
|
@ -514,27 +501,27 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
if (state->lastp25type != 1)
|
||||
{
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr,"\n Ignoring LDU2 not preceeded by LDU1\n");
|
||||
}
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr,"\n Ignoring LDU2 not preceeded by LDU1\n");
|
||||
}
|
||||
state->lastp25type = 0;
|
||||
sprintf (state->fsubtype, " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," LDU2 ");
|
||||
}
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," LDU2 ");
|
||||
}
|
||||
if (opts->mbe_out_dir[0] != 0)
|
||||
{
|
||||
if (opts->mbe_out_f == NULL)
|
||||
{
|
||||
if (opts->mbe_out_f == NULL)
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
}
|
||||
state->lastp25type = 2;
|
||||
sprintf (state->fsubtype, " LDU2 ");
|
||||
state->numtdulc = 0;
|
||||
|
|
@ -546,14 +533,14 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
// Terminator with subsequent Link Control
|
||||
state->dmrburstL = 28;
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," TDULC\n");
|
||||
}
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," TDULC\n");
|
||||
}
|
||||
if (opts->mbe_out_dir[0] != 0)
|
||||
{
|
||||
closeMbeOutFile (opts, state);
|
||||
}
|
||||
{
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
}
|
||||
mbe_initMbeParms (state->cur_mp, state->prev_mp, state->prev_mp_enhanced);
|
||||
state->lasttg = 0;
|
||||
state->lastsrc = 0;
|
||||
|
|
@ -562,9 +549,9 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
sprintf (state->fsubtype, " TDULC ");
|
||||
state->numtdulc++;
|
||||
if ((opts->resume > 0) && (state->numtdulc > opts->resume))
|
||||
{
|
||||
resumeScan (opts, state);
|
||||
}
|
||||
{
|
||||
resumeScan (opts, state);
|
||||
}
|
||||
processTDULC (opts, state);
|
||||
state->err_str[0] = 0;
|
||||
}
|
||||
|
|
@ -573,14 +560,14 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
// Terminator without subsequent Link Control
|
||||
state->dmrburstL = 28;
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," TDU\n");
|
||||
}
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," TDU\n");
|
||||
}
|
||||
if (opts->mbe_out_dir[0] != 0)
|
||||
{
|
||||
closeMbeOutFile (opts, state);
|
||||
}
|
||||
{
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
}
|
||||
mbe_initMbeParms (state->cur_mp, state->prev_mp, state->prev_mp_enhanced);
|
||||
state->lasttg = 0;
|
||||
state->lastsrc = 0;
|
||||
|
|
@ -594,120 +581,126 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
state->dmrburstL = 29;
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," TSBK");
|
||||
}
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," TSBK");
|
||||
}
|
||||
if (opts->mbe_out_dir[0] != 0)
|
||||
{
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
}
|
||||
if (opts->resume > 0)
|
||||
{
|
||||
resumeScan (opts, state);
|
||||
}
|
||||
{
|
||||
resumeScan (opts, state);
|
||||
}
|
||||
state->lasttg = 0;
|
||||
state->lastsrc = 0;
|
||||
state->lastp25type = 3;
|
||||
sprintf (state->fsubtype, " TSBK ");
|
||||
|
||||
// Now processing NID
|
||||
processTSBK(opts, state);
|
||||
|
||||
}
|
||||
else if (strcmp (duid, "30") == 0)
|
||||
{
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," PDU\n");
|
||||
}
|
||||
if (opts->resume > 0)
|
||||
{
|
||||
resumeScan (opts, state);
|
||||
}
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," PDU\n"); //multi block/packet PDU
|
||||
}
|
||||
if (opts->mbe_out_dir[0] != 0)
|
||||
{
|
||||
if (opts->mbe_out_f == NULL)
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
}
|
||||
{
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
}
|
||||
if (opts->resume > 0)
|
||||
{
|
||||
resumeScan (opts, state);
|
||||
}
|
||||
state->lastp25type = 4;
|
||||
sprintf (state->fsubtype, " PDU ");
|
||||
}
|
||||
// try to guess based on previous frame if unknown type
|
||||
else if (state->lastp25type == 1)
|
||||
{
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr,"(LDU2) ");
|
||||
}
|
||||
if (opts->mbe_out_dir[0] != 0)
|
||||
{
|
||||
if (opts->mbe_out_f == NULL)
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
}
|
||||
//state->lastp25type = 0;
|
||||
// Guess that the state is LDU2
|
||||
state->lastp25type = 2;
|
||||
sprintf (state->fsubtype, "(LDU2) ");
|
||||
state->numtdulc = 0;
|
||||
processLDU2 (opts, state);
|
||||
}
|
||||
else if (state->lastp25type == 2)
|
||||
{
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr,"(LDU1) ");
|
||||
}
|
||||
if (opts->mbe_out_dir[0] != 0)
|
||||
{
|
||||
if (opts->mbe_out_f == NULL)
|
||||
{
|
||||
openMbeOutFile (opts, state);
|
||||
}
|
||||
}
|
||||
//state->lastp25type = 0;
|
||||
// Guess that the state is LDU1
|
||||
state->lastp25type = 1;
|
||||
sprintf (state->fsubtype, "(LDU1) ");
|
||||
state->numtdulc = 0;
|
||||
processLDU1 (opts, state);
|
||||
}
|
||||
else if (state->lastp25type == 3)
|
||||
{
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," (TSBK)\n");
|
||||
}
|
||||
//state->lastp25type = 0;
|
||||
// Guess that the state is TSBK
|
||||
state->lastp25type = 3;
|
||||
sprintf (state->fsubtype, "(TSBK) ");
|
||||
|
||||
// Now processing NID
|
||||
skipDibit (opts, state, 328-25);
|
||||
}
|
||||
else if (state->lastp25type == 4)
|
||||
{
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," (PDU)\n");
|
||||
}
|
||||
state->lastp25type = 0;
|
||||
}
|
||||
// try to guess based on previous frame if unknown type
|
||||
// disabling the guessing game on P1
|
||||
|
||||
// else if (state->lastp25type == 1)
|
||||
// {
|
||||
// if (opts->errorbars == 1)
|
||||
// {
|
||||
// printFrameInfo (opts, state);
|
||||
// fprintf (stderr,"(LDU2) ");
|
||||
// }
|
||||
// // if (opts->mbe_out_dir[0] != 0)
|
||||
// // {
|
||||
// // if (opts->mbe_out_f == NULL)
|
||||
// // {
|
||||
// // openMbeOutFile (opts, state);
|
||||
// // }
|
||||
// // }
|
||||
// //state->lastp25type = 0;
|
||||
// // Guess that the state is LDU2
|
||||
// state->lastp25type = 2;
|
||||
// sprintf (state->fsubtype, "(LDU2) ");
|
||||
// state->numtdulc = 0;
|
||||
// processLDU2 (opts, state);
|
||||
// }
|
||||
// else if (state->lastp25type == 2)
|
||||
// {
|
||||
// if (opts->errorbars == 1)
|
||||
// {
|
||||
// printFrameInfo (opts, state);
|
||||
// fprintf (stderr,"(LDU1) ");
|
||||
// }
|
||||
// if (opts->mbe_out_dir[0] != 0)
|
||||
// {
|
||||
// if (opts->mbe_out_f == NULL)
|
||||
// {
|
||||
// openMbeOutFile (opts, state);
|
||||
// }
|
||||
// }
|
||||
// //state->lastp25type = 0;
|
||||
// // Guess that the state is LDU1
|
||||
// state->lastp25type = 1;
|
||||
// sprintf (state->fsubtype, "(LDU1) ");
|
||||
// state->numtdulc = 0;
|
||||
// processLDU1 (opts, state);
|
||||
// }
|
||||
// else if (state->lastp25type == 3)
|
||||
// {
|
||||
// if (opts->errorbars == 1)
|
||||
// {
|
||||
// printFrameInfo (opts, state);
|
||||
// fprintf (stderr," (TSBK)\n");
|
||||
// }
|
||||
// //state->lastp25type = 0;
|
||||
// // Guess that the state is TSBK
|
||||
// state->lastp25type = 3;
|
||||
// sprintf (state->fsubtype, "(TSBK) ");
|
||||
|
||||
// // Now processing NID
|
||||
// skipDibit (opts, state, 328-25);
|
||||
// }
|
||||
// else if (state->lastp25type == 4)
|
||||
// {
|
||||
// if (opts->errorbars == 1)
|
||||
// {
|
||||
// printFrameInfo (opts, state);
|
||||
// fprintf (stderr," (PDU)\n");
|
||||
// }
|
||||
// state->lastp25type = 0;
|
||||
// }
|
||||
|
||||
else
|
||||
{
|
||||
state->lastp25type = 0;
|
||||
sprintf (state->fsubtype, " ");
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
state->lastp25type = 0;
|
||||
sprintf (state->fsubtype, " ");
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," duid:%s *Unknown DUID*\n", duid); //prints on dPMR frame 3
|
||||
// fprintf (stderr, "\n"); //prints on dPMR frame 3
|
||||
}
|
||||
printFrameInfo (opts, state);
|
||||
fprintf (stderr," duid:%s *Unknown DUID*\n", duid); //prints on dPMR frame 3
|
||||
// fprintf (stderr, "\n"); //prints on dPMR frame 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,10 +136,11 @@ noCarrier (dsd_opts * opts, dsd_state * state)
|
|||
state->dmr_payload_p = state->dibit_buf + 200;
|
||||
memset (state->dmr_payload_buf, 0, sizeof (int) * 200);
|
||||
//dmr buffer end
|
||||
if (opts->mbe_out_f != NULL)
|
||||
{
|
||||
closeMbeOutFile (opts, state);
|
||||
}
|
||||
|
||||
//close MBE out files
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
|
||||
state->jitter = -1;
|
||||
state->lastsynctype = -1;
|
||||
state->carrier = 0;
|
||||
|
|
@ -375,8 +376,10 @@ initOpts (dsd_opts * opts)
|
|||
opts->playoffsetR = 0;
|
||||
opts->mbe_out_dir[0] = 0;
|
||||
opts->mbe_out_file[0] = 0;
|
||||
opts->mbe_out_fileR[0] = 0; //second slot on a TDMA system
|
||||
opts->mbe_out_path[0] = 0;
|
||||
opts->mbe_out_f = NULL;
|
||||
opts->mbe_out_fR = NULL; //second slot on a TDMA system
|
||||
opts->audio_gain = 0; //0
|
||||
opts->audio_gainR = 0; //0
|
||||
opts->audio_out = 1;
|
||||
|
|
@ -394,6 +397,7 @@ initOpts (dsd_opts * opts)
|
|||
opts->symbol_out_f = NULL;
|
||||
opts->symbol_out = 0;
|
||||
opts->mbe_out = 0;
|
||||
opts->mbe_outR = 0; //second slot on a TDMA system
|
||||
opts->wav_out_f = NULL;
|
||||
opts->wav_out_fR = NULL;
|
||||
opts->wav_out_raw = NULL;
|
||||
|
|
@ -880,7 +884,7 @@ usage ()
|
|||
printf (" (Use single quotes '/directory/audio file.wav' when directories/spaces are present)\n");
|
||||
printf (" -s <rate> Sample Rate of wav input files (48000 or 96000) Mono only!\n");
|
||||
printf (" -o <device> Audio output device (default is pulse audio)(null for no audio output)\n");
|
||||
printf (" -d <dir> Create mbe data files, use this directory\n");
|
||||
printf (" -d <dir> Create mbe data files, use this directory (TDMA version is experimental)\n");
|
||||
printf (" -r <files> Read/Play saved mbe data from file(s)\n");
|
||||
printf (" -g <num> Audio output gain (default = 0 = auto, disable = -1)\n");
|
||||
printf (" -w <file> Output synthesized speech to a .wav file, legacy auto modes only.\n");
|
||||
|
|
@ -911,7 +915,7 @@ usage ()
|
|||
printf ("Decoder options:\n");
|
||||
printf (" -fa Legacy Auto Detection 8k/1 (old methods default)\n");
|
||||
printf (" -ft XDMA P25 and DMR BS/MS frame types (new default)\n");
|
||||
printf (" -fs DMR Stereo BS and MS Simplex only\n");
|
||||
printf (" -fs DMR Stereo BS and MS Simplex\n");
|
||||
printf (" -f1 Decode only P25 Phase 1\n");
|
||||
printf (" -fd Decode only D-STAR\n");
|
||||
printf (" -fr Decode only DMR Mono - Single Slot Voice\n");
|
||||
|
|
@ -920,7 +924,7 @@ usage ()
|
|||
printf (" -fn Decode only NXDN96* (12.5 kHz)\n");
|
||||
printf (" -fp Decode only EDACS/ProVoice*\n");
|
||||
printf (" -fm Decode only dPMR*\n");
|
||||
printf (" -l Disable DMR and NXDN input filtering\n");
|
||||
printf (" -l Disable DMR, dPMR, and NXDN input filtering\n");
|
||||
printf (" -u <num> Unvoiced speech quality (default=3)\n");
|
||||
printf (" -xx Expect non-inverted X2-TDMA signal\n");
|
||||
printf (" -xr Expect inverted DMR signal\n");
|
||||
|
|
@ -1111,10 +1115,10 @@ cleanupAndExit (dsd_opts * opts, dsd_state * state)
|
|||
{
|
||||
closeSymbolOutFile (opts, state);
|
||||
}
|
||||
if (opts->mbe_out_f != NULL)
|
||||
{
|
||||
closeMbeOutFile (opts, state);
|
||||
}
|
||||
|
||||
//close MBE out files
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
|
||||
fprintf (stderr,"\n");
|
||||
fprintf (stderr,"Total audio errors: %i\n", state->debug_audio_errors);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void playMbeFiles (dsd_opts * opts, dsd_state * state, int argc, char **argv)
|
|||
|
||||
}
|
||||
}
|
||||
else if (state->mbe_file_type == 1) //ambe files
|
||||
else if (state->mbe_file_type > 0) //ambe files
|
||||
{
|
||||
readAmbe2450Data (opts, state, ambe_d);
|
||||
int j, x;
|
||||
|
|
@ -102,8 +102,11 @@ void playMbeFiles (dsd_opts * opts, dsd_state * state, int argc, char **argv)
|
|||
ambe_d[j] ^= x;
|
||||
}
|
||||
}
|
||||
|
||||
mbe_processAmbe2450Dataf (state->audio_out_temp_buf, &state->errs, &state->errs2, state->err_str, ambe_d, state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality);
|
||||
|
||||
//ambe+2
|
||||
if (state->mbe_file_type == 1) mbe_processAmbe2450Dataf (state->audio_out_temp_buf, &state->errs, &state->errs2, state->err_str, ambe_d, state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality);
|
||||
//dstar ambe
|
||||
if (state->mbe_file_type == 2) mbe_processAmbe2400Dataf (state->audio_out_temp_buf, &state->errs, &state->errs2, state->err_str, ambe_d, state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality);
|
||||
|
||||
if (opts->audio_out == 1)
|
||||
{
|
||||
|
|
@ -373,6 +376,13 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
|||
{
|
||||
PrintAMBEData (opts, state, ambe_d);
|
||||
}
|
||||
|
||||
//restore MBE file save, slot 1 -- consider saving even if enc
|
||||
if (opts->mbe_out_f != NULL && (state->dmr_encL == 0 || opts->dmr_mute_encL == 0) )
|
||||
{
|
||||
saveAmbe2450Data (opts, state, ambe_d);
|
||||
}
|
||||
|
||||
}
|
||||
//stereo slots and slot 1 (right slot)
|
||||
if (state->currentslot == 1) //&& opts->dmr_stereo == 1
|
||||
|
|
@ -467,6 +477,12 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
|||
{
|
||||
PrintAMBEData (opts, state, ambe_d);
|
||||
}
|
||||
|
||||
//restore MBE file save, slot 2 -- consider saving even if enc
|
||||
if (opts->mbe_out_fR != NULL && (state->dmr_encR == 0 || opts->dmr_mute_encR == 0) )
|
||||
{
|
||||
saveAmbe2450DataR (opts, state, ambe_d);
|
||||
}
|
||||
}
|
||||
|
||||
//X2-TDMA? Not sure what still makes it this far to run under Framef
|
||||
|
|
|
|||
|
|
@ -287,6 +287,13 @@ void NXDN_decode_VCALL_ASSGN(dsd_opts * opts, dsd_state * state, uint8_t * Messa
|
|||
//rigctl
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
//extra safeguards due to sync issues with NXDN
|
||||
memset (state->nxdn_sacch_frame_segment, 0, sizeof(state->nxdn_sacch_frame_segment));
|
||||
memset (state->nxdn_sacch_frame_segcrc, 1, sizeof(state->nxdn_sacch_frame_segcrc));
|
||||
state->lastsynctype = -1;
|
||||
state->last_cc_sync_time = time(NULL);
|
||||
//
|
||||
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, freq);
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = freq;
|
||||
|
|
@ -295,6 +302,13 @@ void NXDN_decode_VCALL_ASSGN(dsd_opts * opts, dsd_state * state, uint8_t * Messa
|
|||
//rtl_udp
|
||||
else if (opts->audio_in_type == 3)
|
||||
{
|
||||
//extra safeguards due to sync issues with NXDN
|
||||
memset (state->nxdn_sacch_frame_segment, 0, sizeof(state->nxdn_sacch_frame_segment));
|
||||
memset (state->nxdn_sacch_frame_segcrc, 1, sizeof(state->nxdn_sacch_frame_segcrc));
|
||||
state->lastsynctype = -1;
|
||||
state->last_cc_sync_time = time(NULL);
|
||||
//
|
||||
|
||||
rtl_udp_tune (opts, state, freq);
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = freq;
|
||||
opts->p25_is_tuned = 1;
|
||||
|
|
|
|||
|
|
@ -247,7 +247,30 @@ void nxdn_frame (dsd_opts * opts, dsd_state * state)
|
|||
if (facch2) nxdn_deperm_facch2_udch(opts, state, facch2_bits);
|
||||
if (facch & 1) nxdn_deperm_facch(opts, state, facch_bits_a);
|
||||
if (facch & 2) nxdn_deperm_facch(opts, state, facch_bits_b);
|
||||
if (voice) nxdn_voice (opts, state, voice, dbuf);
|
||||
if (voice)
|
||||
{
|
||||
//restore MBE file open here
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) openMbeOutFile (opts, state);
|
||||
//update last voice sync time
|
||||
state->last_vc_sync_time = time(NULL);
|
||||
//process voice frame
|
||||
nxdn_voice (opts, state, voice, dbuf);
|
||||
}
|
||||
//close MBE file if no voice and its open
|
||||
if (!voice)
|
||||
{
|
||||
if (opts->mbe_out_f != NULL)
|
||||
{
|
||||
if (opts->frame_nxdn96 == 1) //nxdn96 has voice and data mixed together, so we will need to do a time check first
|
||||
{
|
||||
if ( (time(NULL) - state->last_vc_sync_time) > 1) //test for optimal time, 1 sec should be okay
|
||||
{
|
||||
closeMbeOutFile (opts, state);
|
||||
}
|
||||
}
|
||||
if (opts->frame_nxdn48 == 1) closeMbeOutFile (opts, state); //okay to close right away if nxdn48, no data/voice mixing
|
||||
}
|
||||
}
|
||||
|
||||
fprintf (stderr, "\n");
|
||||
END: ; //do nothing
|
||||
|
|
|
|||
|
|
@ -686,10 +686,20 @@ void process_P2_DUID (dsd_opts * opts, dsd_state * state)
|
|||
if (state->currentslot == 0 && duid_decoded != 3 && duid_decoded != 12)
|
||||
{
|
||||
fprintf (stderr, "VCH 0 ");
|
||||
//open MBEout file - slot 1 - USE WITH CAUTION on Phase 2! Consider using a symbol capture bin instead!
|
||||
if (duid_decoded == 0 || duid_decoded == 6) //4V or 2V (voice)
|
||||
{
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) openMbeOutFile (opts, state);
|
||||
}
|
||||
}
|
||||
else if (state->currentslot == 1 && duid_decoded != 3 && duid_decoded != 12)
|
||||
{
|
||||
fprintf (stderr, "VCH 1 ");
|
||||
//open MBEout file - slot 2 - USE WITH CAUTION on Phase 2! Consider using a symbol capture bin instead!
|
||||
if (duid_decoded == 0 || duid_decoded == 6) //4V or 2V (voice)
|
||||
{
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_fR == NULL)) openMbeOutFileR (opts, state);
|
||||
}
|
||||
}
|
||||
else fprintf (stderr, "VCH S ");
|
||||
|
||||
|
|
|
|||
|
|
@ -202,6 +202,10 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180]
|
|||
//print it and then zero out
|
||||
state->lastsrc = 0;
|
||||
state->lasttg = 0;
|
||||
|
||||
//close any open MBEout files
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
|
||||
}
|
||||
if (state->currentslot == 0)
|
||||
{
|
||||
|
|
@ -218,6 +222,9 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180]
|
|||
//print it and then zero out
|
||||
state->lastsrcR = 0;
|
||||
state->lasttgR = 0;
|
||||
|
||||
//close any open MBEout files
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
}
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
|
|
@ -241,8 +248,18 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180]
|
|||
}
|
||||
if (opcode == 0x6 && err == 0)
|
||||
{
|
||||
if (state->currentslot == 1) state->dmrburstL = 22;
|
||||
else state->dmrburstR = 22;
|
||||
if (state->currentslot == 1)
|
||||
{
|
||||
state->dmrburstL = 21;
|
||||
//close any open MBEout files
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
state->dmrburstR = 21;
|
||||
//close any open MBEout files
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
}
|
||||
fprintf (stderr, " MAC_HANGTIME ");
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
process_MAC_VPDU(opts, state, 1, SMAC);
|
||||
|
|
@ -412,6 +429,10 @@ void process_FACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[156]
|
|||
//print it and then zero out
|
||||
state->lastsrc = 0;
|
||||
state->lasttg = 0;
|
||||
|
||||
//close any open MBEout files
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
|
||||
}
|
||||
if (state->currentslot == 1)
|
||||
{
|
||||
|
|
@ -428,6 +449,9 @@ void process_FACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[156]
|
|||
//print it and then zero out
|
||||
state->lastsrcR = 0;
|
||||
state->lasttgR = 0;
|
||||
|
||||
//close any open MBEout files
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
}
|
||||
fprintf (stderr, "%s", KNRM);
|
||||
}
|
||||
|
|
@ -471,8 +495,18 @@ void process_FACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[156]
|
|||
}
|
||||
if (opcode == 0x6 && err == 0)
|
||||
{
|
||||
if (state->currentslot == 0) state->dmrburstL = 22;
|
||||
else state->dmrburstR = 22;
|
||||
if (state->currentslot == 0)
|
||||
{
|
||||
state->dmrburstL = 22;
|
||||
//close any open MBEout files
|
||||
if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
state->dmrburstR = 22;
|
||||
//close any open MBEout files
|
||||
if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state);
|
||||
}
|
||||
fprintf (stderr, " MAC_HANGTIME ");
|
||||
fprintf (stderr, "%s", KYEL);
|
||||
process_MAC_VPDU(opts, state, 0, FMAC);
|
||||
|
|
|
|||
Loading…
Reference in New Issue