Fix/Restore MBEout Files; 'DSP' CACH; Tweaks;

This commit is contained in:
lwvmobile 2023-01-17 02:25:53 -05:00
parent 7ca8cb421c
commit 1d49481f2d
12 changed files with 592 additions and 387 deletions

View File

@ -203,8 +203,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;
@ -218,6 +220,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;
@ -357,7 +360,7 @@ typedef struct
//'DSP' Format Output
uint8_t use_dsp_output;
char dsp_out_file[1024];
char dsp_out_file[2048];
} dsd_opts;
@ -754,13 +757,16 @@ 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);

View File

@ -265,6 +265,9 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
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", "-");
@ -389,6 +399,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
{
@ -434,6 +450,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)
{
@ -652,6 +672,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
{
@ -668,10 +694,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", "-");
@ -709,7 +739,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)

View File

@ -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
{

View File

@ -34,7 +34,7 @@ char * getTimeF(void) //get pretty hh:mm:ss timestamp
}
char * getDateF(void) {
char datename[120]; //bug in 32-bit Ubuntu when using date in filename, date is garbage text
char datename[80]; //32-bit needs this to be 80
char * curr2;
struct tm * to;
time_t t;
@ -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;

View File

@ -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
}
}
}

View File

@ -52,7 +52,7 @@ char * FM_banner[9] = {
" ██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ",
" ██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗",
" ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝",
" 'Lite' Edition v2.0.0-10-gb2ccd3a Windows 32-bit RC2b "
" 'Lite' Edition v2.0.0-17-gdcb21f2 Windows 32-bit RC2b "
};
int
@ -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;
@ -376,8 +377,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;
@ -395,6 +398,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;
@ -890,7 +894,7 @@ usage ()
printf (" -o <device> Audio output device (default is /dev/dsp)\n");
printf (" null for no audio output\n");
printf (" pulse for pulse audio \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");
@ -920,9 +924,9 @@ usage ()
printf (" Example: dsd-fme-lite -fp -i rtl:0:851.375M:22:-2:12:0:6021\n");
printf ("\n");
printf ("Decoder options:\n");
printf (" -fa Legacy Auto Detection 8k/1 (old methods default)\n");
printf (" -fa Legacy Auto Detection (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");
@ -931,7 +935,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");
@ -1123,10 +1127,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);
@ -1622,10 +1626,10 @@ main (int argc, char **argv)
opts.frame_dpmr = 0;
opts.frame_provoice = 0;
opts.frame_ysf = 0;
opts.pulse_digi_rate_out = 8000; //doesn't matter for /dev/dsp anyways
opts.pulse_digi_rate_out = 48000; // /dev/dsp does need this set to 48000 to properly process the upsampling
opts.pulse_digi_out_channels = 1;
opts.dmr_stereo = 0;
opts.dmr_mono = 1;
opts.dmr_stereo = 1; //switching in 'stereo' for 'mono'
opts.dmr_mono = 0;
state.dmr_stereo = 0;
opts.setmod_bw = 7000;
sprintf (opts.output_name, "Legacy Auto");
@ -1908,7 +1912,7 @@ main (int argc, char **argv)
opts.setmod_bw = 7000;
sprintf (opts.output_name, "DMR Mono");
//fprintf(stderr, "Notice: DMR cannot autodetect polarity. \n Use -xr option if Inverted Signal expected.\n");
fprintf (stderr,"Decoding only DMR Mono. \nUsing DMR Stereo or XDMA is highly encouraged.\n");
fprintf (stderr,"Decoding only DMR Mono. \nUsing DMR Stereo '-fs' or XDMA '-ft' is highly encouraged.\n");
//dmr stereo below
// opts.frame_dstar = 0;
// opts.frame_x2tdma = 0;

View File

@ -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)
{
@ -375,6 +378,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
@ -469,6 +479,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

View File

@ -1690,8 +1690,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->audio_in_type != 1) //can't run getch/menu when using STDIN -
{
timeout(0);
c = getch();
timeout(0); //
c = getch(); //
}
//use rtl_udp_tune
@ -2053,7 +2053,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->ncurses_compact == 1)
{
printw ("------------------------------------------------------------------------------\n");
printw ("| Digital Speech Decoder: Florida Man Edition - Win32 %s \n", "v2.0.0-10-gb2ccd3a RC2a");
printw ("| Digital Speech Decoder: Florida Man Edition - Win32 %s \n", "v2.0.0-17-gdcb21f2 RC2b");
}
if (opts->ncurses_compact == 0)
{
@ -2064,8 +2064,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (i == 1) printw (" ESC to Menu");
if (i == 2) printw (" 'q' to Quit ");
if (i == 4) printw (" MBElib %s", versionstr);
if (i == 5) printw (" %s ", "Win32 RC2a"); //printw (" %s \n", GIT_TAG);
if (i == 6) printw (" %s \n", "v2.0.0-10-gb2ccd3a"); //printw (" %s \n", GIT_TAG);
if (i == 5) printw (" %s ", "Win32 RC2b"); //printw (" %s \n", GIT_TAG);
if (i == 6) printw (" %s \n", "v2.0.0-17-gdcb21f2"); //printw (" %s \n", GIT_TAG);
else printw ("\n");
}
attroff(COLOR_PAIR(6)); //6
@ -3114,21 +3114,24 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
}
}
if (c == 32) //'space bar' replay last bin file (rework to do wav files too?)
{
struct stat stat_buf;
if (stat(opts->audio_in_dev, &stat_buf) != 0)
{
fprintf (stderr,"Error, couldn't open %s\n", opts->audio_in_dev);
goto SKIPR;
}
if (S_ISREG(stat_buf.st_mode))
{
opts->symbolfile = fopen(opts->audio_in_dev, "r");
opts->audio_in_type = 4; //symbol capture bin files
}
SKIPR: ; //do nothing
}
//
// if (c == 32) //'space bar' replay last bin file (rework to do wav files too?)
// {
// struct stat stat_buf;
// if (stat(opts->audio_in_dev, &stat_buf) != 0)
// {
// fprintf (stderr,"Error, couldn't open %s\n", opts->audio_in_dev);
// goto SKIPR;
// }
// if (S_ISREG(stat_buf.st_mode))
// {
// opts->symbolfile = fopen(opts->audio_in_dev, "r");
// opts->audio_in_type = 4; //symbol capture bin files
// }
// SKIPR: ; //do nothing
// }
//
if (c == 80) //'P' key - start per call wav files
{
@ -3161,33 +3164,34 @@ if (c == 112) //'p' key - stop all per call wav files
opts->dmr_stereo_wav = 0;
}
//
// if (c == 115) //'s' key, stop playing wav or symbol in files
// {
// if (opts->symbolfile != NULL)
// {
// if (opts->audio_in_type == 4)
// {
// fclose(opts->symbolfile);
// }
// }
if (c == 115) //'s' key, stop playing wav or symbol in files
{
if (opts->symbolfile != NULL)
{
if (opts->audio_in_type == 4)
{
fclose(opts->symbolfile);
}
}
// if (opts->audio_in_type == 2) //wav input file
// {
// sf_close(opts->audio_in_file);
// }
if (opts->audio_in_type == 2) //wav input file
{
sf_close(opts->audio_in_file);
}
if (opts->audio_out_type == 0)
{
opts->audio_in_type = 0;
openPulseInput(opts);
}
else opts->audio_in_type = 5;//cleanupAndExit(opts, state);
// if (opts->audio_out_type == 0)
// {
// opts->audio_in_type = 0;
// openPulseInput(opts);
// }
// else opts->audio_in_type = 5;//cleanupAndExit(opts, state);
}
// }
//
//Lockout bug in EDACS prevents any group from tuning when using this, not sure why yet
//WARNING! USE THESE WITH CAUTION! IF BREAKING ISSUES OBSERVED, THEN RESTART AND DON'T USE THEM!!
// //Lockout bug in EDACS prevents any group from tuning when using this, not sure why yet
// //WARNING! USE THESE WITH CAUTION! IF BREAKING ISSUES OBSERVED, THEN RESTART AND DON'T USE THEM!!
if (opts->frame_provoice != 1 && c == 49) //'1' key, lockout slot 1 or conventional tg from tuning/playback during session
{
state->group_array[state->group_tally].groupNumber = state->lasttg;

View File

@ -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;

View File

@ -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

View File

@ -694,10 +694,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 ");

View File

@ -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);
}
@ -232,8 +239,9 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180]
}
if (opcode == 0x4 && err == 0)
{
if (state->currentslot == 1) state->dmrburstL = 21;
else state->dmrburstR = 21;
//disable to prevent blinking in ncurses terminal due to OSS preemption shim
//if (state->currentslot == 1) state->dmrburstL = 21;
//else state->dmrburstR = 21;
fprintf (stderr, " MAC_ACTIVE ");
fprintf (stderr, "%s", KYEL);
process_MAC_VPDU(opts, state, 1, SMAC);
@ -241,8 +249,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 +430,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 +450,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);
}
@ -462,8 +487,9 @@ void process_FACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[156]
}
if (opcode == 0x4 && err == 0)
{
if (state->currentslot == 0) state->dmrburstL = 21;
else state->dmrburstR = 21;
//disable to prevent blinking in ncurses terminal due to OSS preemption shim
//if (state->currentslot == 0) state->dmrburstL = 21;
//else state->dmrburstR = 21;
fprintf (stderr, " MAC_ACTIVE ");
fprintf (stderr, "%s", KYEL);
process_MAC_VPDU(opts, state, 0, FMAC);
@ -471,8 +497,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);