Encrypted DMR muted by default now

Encrypted DMR muted by default now; Can be toggled in Terminal; Will still dump payload on request. Fix Bug in DMR Stereo 'muddy sound' caused by appending audio errs to both left and right channel each pass instead of only when using left or right.

--will not playback audio or write wav files or mbe files when muted

Fix errs and errsR to only append/set in MBE when on that slot, not always
This commit is contained in:
lwvmobile
2022-08-10 23:39:19 -04:00
committed by GitHub
parent 6043b14c13
commit 2b847c2270
6 changed files with 173 additions and 171 deletions

View File

@@ -340,11 +340,13 @@ typedef struct
int dPMR_next_part_of_superframe;
int inverted_dpmr;
int frame_dpmr;
//
short int dmr_stereo;
short int lrrp_file_output;
//
short int dmr_mute_encL;
short int dmr_mute_encR;
int frame_ysf;
int inverted_ysf;
short int aggressive_framesync;
@@ -561,7 +563,9 @@ typedef struct
unsigned int dmrburstR;
unsigned long long int R;
// int block_count;
short int dmr_encL;
short int dmr_encR;
//dstar header for ncurses
unsigned char dstarradioheader[41];

View File

@@ -136,25 +136,36 @@ if (state->currentslot == 0)
PrintAMBEData(opts, state, TSVoiceSupFrameL->TimeSlotAmbeVoiceFrame[Frame].AmbeBit[i]);
}
if (opts->mbe_out_f != NULL)
//quick enc toggle to determine whether or not to play enc traffic
int enc_bit = 0;
enc_bit = (state->dmr_so >> 6) & 0x1;
if (enc_bit == 1)
{
saveAmbe2450Data (opts, state, TSVoiceSupFrameL->TimeSlotAmbeVoiceFrame[Frame].AmbeBit[i]);
state->dmr_encL = 1;
}
state->debug_audio_errors += *errs2;
processAudio(opts, state);
if (opts->wav_out_f != NULL)
else state->dmr_encL = 0;
//quick test to determine whether or not to run the next few steps below
if (state->dmr_encL == 0 || opts->dmr_mute_encL == 0)
{
writeSynthesizedVoice (opts, state);
}
if (opts->mbe_out_f != NULL)
{
saveAmbe2450Data (opts, state, TSVoiceSupFrameL->TimeSlotAmbeVoiceFrame[Frame].AmbeBit[i]);
}
//play only if not equal to enc value, going to set p25enc to 1 if enc detected??
if (opts->audio_out == 1 && opts->p25enc != 1)
{
playSynthesizedVoice (opts, state);
}
state->debug_audio_errors += *errs2;
processAudio(opts, state);
if (opts->wav_out_f != NULL)
{
writeSynthesizedVoice (opts, state);
}
if (opts->audio_out == 1) //opts->audio_out == 1
{
playSynthesizedVoice (opts, state);
}
} //second bracket for the test enc condition
} /* End for(i = 0; i < 3; i++) */
} /* End for(Frame = 0; Frame < 6; Frame++) */
} //End if Current Slot == 0
@@ -182,24 +193,36 @@ if (state->currentslot == 0)
PrintAMBEData(opts, state, TSVoiceSupFrameR->TimeSlotAmbeVoiceFrame[Frame].AmbeBit[i]);
}
if (opts->mbe_out_f != NULL)
//quick enc toggle to determine whether or not to play enc traffic
int enc_bit = 0;
enc_bit = (state->dmr_soR >> 6) & 0x1;
if (enc_bit == 1)
{
saveAmbe2450Data (opts, state, TSVoiceSupFrameR->TimeSlotAmbeVoiceFrame[Frame].AmbeBit[i]);
state->dmr_encR = 1;
}
else state->dmr_encR = 0;
state->debug_audio_errors += *errs2;
processAudio(opts, state);
if (opts->wav_out_f != NULL)
//quick test to determine whether or not to run the next few steps below
if (state->dmr_encR == 0 || opts->dmr_mute_encR == 0)
{
writeSynthesizedVoice (opts, state);
}
if (opts->mbe_out_f != NULL)
{
saveAmbe2450Data (opts, state, TSVoiceSupFrameR->TimeSlotAmbeVoiceFrame[Frame].AmbeBit[i]);
}
//play only if not equal to enc value, going to set p25enc to 1 if enc detected??
if (opts->audio_out == 1 && opts->p25enc != 1)
{
playSynthesizedVoice (opts, state);
state->debug_audio_errors += *errs2;
processAudio(opts, state);
if (opts->wav_out_f != NULL)
{
writeSynthesizedVoice (opts, state);
}
if (opts->audio_out == 1)
{
playSynthesizedVoice (opts, state);
}
}
} /* End for(i = 0; i < 3; i++) */
} /* End for(Frame = 0; Frame < 6; Frame++) */

View File

@@ -119,7 +119,6 @@ void Process34Data(dsd_opts * opts, dsd_state * state, unsigned char tdibits[98]
k++;
}
//state->dmr_34_rate_sf[slot][i+48] = TrellisReturn[i+2]; //plus two to skip the first two bytes
state->dmr_34_rate_sf[slot][i+(blocks*16)] = TrellisReturn[i+2]; //plus two to skip the first two bytes
}
@@ -153,7 +152,6 @@ void Process34Data(dsd_opts * opts, dsd_state * state, unsigned char tdibits[98]
fprintf (stderr, "%s ", KMAG);
//go to number of octets minus padding and crc, confirmed data may need a second rule to skip Serial Numbers and Block CRCs
//for (short i = 12; i < ( ((blocks+1)*12) - (padding+4) ); i++)
for (short i = 12; i < ( ((blocks+1)*16) - (padding+4) ); i++)
{
@@ -337,7 +335,6 @@ void ProcessDataData(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint
state->dmr_12_rate_sf[slot][i] = 0;
}
//Placeholder
uint32_t i, j, k;
uint32_t CRCExtracted = 0;
uint32_t CRCComputed = 0;
@@ -608,7 +605,7 @@ void ProcessDataData(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint
void Process1Data(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t syncdata[48], uint8_t SlotType[20])
{
//Placeholder
uint32_t i, j, k;
uint32_t CRCExtracted = 0;
uint32_t CRCComputed = 0;
@@ -711,7 +708,7 @@ void Process1Data(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t
void ProcessMBChData(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t syncdata[48], uint8_t SlotType[20])
{
//Placeholder
uint32_t i, j, k;
uint32_t CRCExtracted = 0;
uint32_t CRCComputed = 0;
@@ -803,7 +800,7 @@ void ProcessMBChData(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint
void ProcessMBCData(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t syncdata[48], uint8_t SlotType[20])
{
//Placeholder
uint32_t i, j, k;
uint32_t CRCExtracted = 0;
uint32_t CRCComputed = 0;
@@ -901,7 +898,7 @@ void ProcessMBCData(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8
//This data shouldn't be active, but come here to dump in case of data burst type decoding failure
void ProcessReservedData(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t syncdata[48], uint8_t SlotType[20])
{
//Placeholder
uint32_t i, j, k;
uint32_t CRCExtracted = 0;
uint32_t CRCComputed = 0;
@@ -1147,7 +1144,7 @@ void Process12Data(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_
DmrDataByte[i] = DmrDataByte[i] | (DmrDataBit[k] & 0x01);
k++;
}
//state->dmr_12_rate_sf[slot][i+48] = DmrDataByte[i]; //copy byte to right hand side of shift frame
//start loading new superframe at appropriate block count determined by the data header
state->dmr_12_rate_sf[slot][i+(blocks*12)] = DmrDataByte[i]; //if 3 blocks, then start at position 36; 4 blocks at 48, 5 at
}
@@ -1200,8 +1197,6 @@ void Process12Data(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_
int message_legnth = 0;
if ( (state->dmr_12_rate_sf[slot][0] & 0x7F) == 0x45) //Start LRRP now
{
//test opening a file with fopen and dumping the LRRP data into it.
//just going to use the same code from EDACS-FM
//find user home directory and append directory and filename.
FILE * pFile; //put this outside of the if statement?
@@ -1395,7 +1390,7 @@ void Process12Data(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_
void ProcessCSBK(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t syncdata[48], uint8_t SlotType[20])
{
//Placeholder
uint32_t i, j, k;
uint32_t CRCExtracted = 0;
uint32_t CRCComputed = 0;
@@ -1463,11 +1458,9 @@ void ProcessCSBK(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t
}
/* Apply the CRC mask (see DMR standard B.3.12 Data Type CRC Mask) */
//CRCExtracted = CRCExtracted ^ 0x969696; //does this mask get applied here though for PI?
CRCExtracted = CRCExtracted ^ 0xA5A5;
/* Check/correct the full link control data and compute the Reed-Solomon (12,9) CRC */
//CRCCorrect = ComputeAndCorrectFullLinkControlCrc(DmrDataByte, &CRCComputed, 0x969696);
CRCCorrect = ComputeAndCorrectFullLinkControlCrc(DmrDataByte, &CRCComputed, 0xA5A5);
//test
@@ -1693,7 +1686,7 @@ void ProcessCSBK(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t
void ProcessDmrPIHeader(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t syncdata[48], uint8_t SlotType[20])
{
//Placeholder
uint32_t i, j, k;
uint32_t CRCExtracted = 0;
uint32_t CRCComputed = 0;
@@ -1706,11 +1699,6 @@ void ProcessDmrPIHeader(dsd_opts * opts, dsd_state * state, uint8_t info[196], u
uint8_t R[3];
uint8_t BPTCReservedBits = 0;
/* Remove warning compiler */
//UNUSED_VARIABLE(syncdata[0]);
//UNUSED_VARIABLE(SlotType[0]);
//UNUSED_VARIABLE(BPTCReservedBits);
/* Check the current time slot */
if(state->currentslot == 0)
{
@@ -1758,11 +1746,9 @@ void ProcessDmrPIHeader(dsd_opts * opts, dsd_state * state, uint8_t info[196], u
}
/* Apply the CRC mask (see DMR standard B.3.12 Data Type CRC Mask) */
//CRCExtracted = CRCExtracted ^ 0x969696; //does this mask get applied here though for PI?
CRCExtracted = CRCExtracted ^ 0x6969;
/* Check/correct the full link control data and compute the Reed-Solomon (12,9) CRC */
//CRCCorrect = ComputeAndCorrectFullLinkControlCrc(DmrDataByte, &CRCComputed, 0x969696);
CRCCorrect = ComputeAndCorrectFullLinkControlCrc(DmrDataByte, &CRCComputed, 0x6969);
/* Convert corrected 12 bytes into 96 bits */
@@ -1864,11 +1850,6 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
uint8_t R[3];
uint8_t BPTCReservedBits = 0;
/* Remove warning compiler */
//UNUSED_VARIABLE(syncdata[0]);
//UNUSED_VARIABLE(SlotType[0]);
//UNUSED_VARIABLE(BPTCReservedBits);
/* Check the current time slot */
if(state->currentslot == 0)
{
@@ -1950,7 +1931,7 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
/* Store the Group address (Talk Group) */
TSVoiceSupFrame->FullLC.GroupAddress = (unsigned int)ConvertBitIntoBytes(&DmrDataBit[24], 24);
//state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
/* Store the Source address */
TSVoiceSupFrame->FullLC.SourceAddress = (unsigned int)ConvertBitIntoBytes(&DmrDataBit[48], 24);
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
@@ -1998,13 +1979,6 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
fprintf (stderr, "%s \n", KGRN);
fprintf (stderr, " Slot %d ", state->currentslot+1);
fprintf(stderr, " TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
//fprintf(stderr, "FID=0x%02X ", TSVoiceSupFrame->FullLC.FeatureSetID);
//state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
//state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
//HERE HERE do some work to get this Emergency and BP modes to display in ncurses
//state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x80) fprintf(stderr, "Emergency ");
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x40)
@@ -2104,12 +2078,6 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
uint8_t R[3];
uint8_t BPTCReservedBits = 0;
/* Remove warning compiler */
//UNUSED_VARIABLE(opts);
//UNUSED_VARIABLE(syncdata[0]);
//UNUSED_VARIABLE(SlotType[0]);
//UNUSED_VARIABLE(BPTCReservedBits);
/* Check the current time slot */
if(state->currentslot == 0)
{
@@ -2191,12 +2159,10 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
/* Store the Group address (Talk Group) */
TSVoiceSupFrame->FullLC.GroupAddress = (unsigned int)ConvertBitIntoBytes(&DmrDataBit[24], 24);
//state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
/* Store the Source address */
TSVoiceSupFrame->FullLC.SourceAddress = (unsigned int)ConvertBitIntoBytes(&DmrDataBit[48], 24);
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
//TSVoiceSupFrame->FullLC.LeftOvers = (unsigned int)ConvertBitIntoBytes(&DmrDataBit[64], 8);
//fprintf (stderr, "\nBPTC Left Overs = %02X \n", TSVoiceSupFrame->FullLC.LeftOvers);
if((IrrecoverableErrors == 0))// && CRCCorrect)
{
/* CRC is correct so consider the Full LC data as correct/valid */
@@ -2208,11 +2174,7 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
TSVoiceSupFrame->FullLC.DataValidity = 0;
}
/* Print the destination ID (TG) and the source ID */
//fprintf(stderr, "\n TG=%u Src=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
//fprintf(stderr, "FID=0x%02X ", TSVoiceSupFrame->FullLC.FeatureSetID);
//reset alg, keys, mi during a TLC call termination EVENT so we aren't stuck on an old value, PI header will proceed a new call if BP isn't used
//reset alg, keys, mi during a TLC call termination EVENT so we aren't stuck on an old value
if (state->currentslot == 0)
{
state->payload_algid = 0;
@@ -2230,7 +2192,6 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
}
//tlc
if((IrrecoverableErrors == 0) && CRCCorrect) //amateur DMR seems to only set radio ID up here I think, figure out best way to set without messing up other DMR types
{
@@ -2241,39 +2202,18 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
fprintf (stderr, "%s ", KNRM);
//fprintf(stderr, "(CRC OK ) ");
if (TSVoiceSupFrame->FullLC.FullLinkControlOpcode == 0) //other opcodes may convey callsigns, names, etc.
/*
if ( TSVoiceSupFrame->FullLC.FullLinkControlOpcode != 0xAF ||
TSVoiceSupFrame->FullLC.FullLinkControlOpcode != 0x04 ||
TSVoiceSupFrame->FullLC.FullLinkControlOpcode != 0x05 ||
TSVoiceSupFrame->FullLC.FullLinkControlOpcode != 0x06 ||
TSVoiceSupFrame->FullLC.FullLinkControlOpcode != 0x07 ) //work out why amateur sets sourceid on other codes, but pro only does on whatever
*/
{
if (state->currentslot == 0)
{
//state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
//state->dmr_color_code = state->color_code;
state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
}
if (state->currentslot == 1)
{
//state->lasttgR = TSVoiceSupFrame->FullLC.GroupAddress;
//state->lastsrcR = TSVoiceSupFrame->FullLC.SourceAddress;
//state->dmr_color_code = state->color_code;
state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
}
}
//only set on good CRC value or corrected values
//state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
//state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
//state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
//state->dmr_color_code = state->color_code;
}
else if(IrrecoverableErrors == 0)
{
@@ -2284,37 +2224,19 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
fprintf(stderr, "RAS (FEC OK/CRC ERR)"); //tlc
fprintf (stderr, "%s ", KNRM);
if (TSVoiceSupFrame->FullLC.FullLinkControlOpcode == 0) //other opcodes may convey callsigns, names, etc.
/*
if ( TSVoiceSupFrame->FullLC.FullLinkControlOpcode != 0xAF ||
TSVoiceSupFrame->FullLC.FullLinkControlOpcode != 0x04 ||
TSVoiceSupFrame->FullLC.FullLinkControlOpcode != 0x05 ||
TSVoiceSupFrame->FullLC.FullLinkControlOpcode != 0x06 ||
TSVoiceSupFrame->FullLC.FullLinkControlOpcode != 0x07 ) //work out why amateur sets sourceid on other codes, but pro only does on whatever
*/
{
if (state->currentslot == 0)
{
//state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
//state->dmr_color_code = state->color_code;
state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
}
if (state->currentslot == 1)
{
//state->lasttgR = TSVoiceSupFrame->FullLC.GroupAddress;
//state->lastsrcR = TSVoiceSupFrame->FullLC.SourceAddress;
//state->dmr_color_code = state->color_code;
state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
}
}
//only set on good CRC value or corrected values
//state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
//state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
//state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
//state->dmr_color_code = state->color_code;
}
else {} //fprintf(stderr, "\n(FEC FAIL/CRC ERR)");
@@ -2438,7 +2360,7 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
CRCExtracted |= (LC_DataBit[74] & 1) << 2;
CRCExtracted |= (LC_DataBit[75] & 1) << 1;
CRCExtracted |= (LC_DataBit[76] & 1) << 0;
//fprintf (stderr, "\nLCDB = 0x%X \n", LC_DataBit);
/* Compute the 5 bit CRC */
CRCComputed = ComputeCrc5Bit(LC_DataBit);
@@ -2463,7 +2385,7 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
/* Store the Group address (Talk Group) */
TSVoiceSupFrame->FullLC.GroupAddress = (unsigned int)ConvertBitIntoBytes(&LC_DataBit[24], 24);
//state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
/* Store the Source address */
TSVoiceSupFrame->FullLC.SourceAddress = (unsigned int)ConvertBitIntoBytes(&LC_DataBit[48], 24);
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
@@ -2575,22 +2497,11 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
}
//state->dmr_color_code = state->color_code;
//state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
//state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
}
//state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
//state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
//state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
//state->dmr_color_code = state->color_code;
}
else if(IrrecoverableErrors == 0)
{
//fprintf(stderr, " TG=%u Src=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
//fprintf(stderr, "FID=0x%02X ", TSVoiceSupFrame->FullLC.FeatureSetID);
//fprintf(stderr, "RAS (FEC OK/CRC ERR)"); //voice burst
//or set if was corrected
if (TSVoiceSupFrame->FullLC.FullLinkControlOpcode < 0x04 || TSVoiceSupFrame->FullLC.FullLinkControlOpcode > 0x08) //7, or 8?
{
fprintf (stderr, "%s", KGRN);
@@ -2610,7 +2521,7 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
//state->dmr_color_code = state->color_code;
state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
// state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
}
if (state->currentslot == 1)
{
@@ -2618,17 +2529,9 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
state->lastsrcR = TSVoiceSupFrame->FullLC.SourceAddress;
//state->dmr_color_code = state->color_code;
state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
// state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
}
//state->dmr_color_code = state->color_code;
//state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
//state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
}
//state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
//state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
//state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
//state->dmr_color_code = state->color_code;
}
else {} //fprintf(stderr, "\n(FEC FAIL/CRC ERR)");

View File

@@ -180,9 +180,12 @@ noCarrier (dsd_opts * opts, dsd_state * state)
state->data_p_head[0] = 0;
state->data_p_head[1] = 0;
// state->dmr_so = 0; //let TLC or Voice Burst zero or set this instead?
// state->dmr_so = 0; //let TLC or Voice LC/Burst zero or set this instead?
// state->dmr_soR = 0;
state->dmr_encL = 0;
state->dmr_encR = 0;
}
void
@@ -292,6 +295,8 @@ initOpts (dsd_opts * opts)
opts->lrrp_file_output = 0;
opts->dmr_mute_encL = 1;
opts->dmr_mute_encR = 1;
}
@@ -517,6 +522,9 @@ initState (dsd_state * state)
state->menuopen = 0; //is the ncurses menu open, if so, don't process frame sync
state->dmr_encL = 0;
state->dmr_encR = 0;
#ifdef TRACE_DSD
state->debug_sample_index = 0;
state->debug_label_file = NULL;
@@ -919,6 +927,13 @@ main (int argc, char **argv)
{
state.K = 256;
}
opts.dmr_mute_encL = 0;
opts.dmr_mute_encR = 0;
if (state.K == 1)
{
opts.dmr_mute_encL = 1;
opts.dmr_mute_encR = 1;
}
break;
case 'G': //Set rtl device gain

View File

@@ -239,11 +239,10 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
ambe_d[j] ^= x;
}
}
if (1 == 1) //still not quite right //state->payload_algid == 0 || state->K != 0
{
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);
}
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);
//old method for this step below
//mbe_processAmbe3600x2450Framef (state->audio_out_temp_buf, &state->errs, &state->errs2, state->err_str, ambe_fr, ambe_d, state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality);
@@ -272,11 +271,9 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
ambe_d[j] ^= x;
}
}
if (1 == 1) //state->payload_algidR == 0 || state->K != 0
{
mbe_processAmbe2450Dataf (state->audio_out_temp_bufR, &state->errsR, &state->errs2R, state->err_strR,
ambe_d, state->cur_mp2, state->prev_mp2, state->prev_mp_enhanced2, opts->uvquality);
}
mbe_processAmbe2450Dataf (state->audio_out_temp_bufR, &state->errsR, &state->errs2R, state->err_strR,
ambe_d, state->cur_mp2, state->prev_mp2, state->prev_mp_enhanced2, opts->uvquality);
//old method for this step below
//mbe_processAmbe3600x2450Framef (state->audio_out_temp_bufR, &state->errsR, &state->errs2R, state->err_strR, ambe_fr, ambe_d, state->cur_mp2, state->prev_mp2, state->prev_mp_enhanced2, opts->uvquality);
@@ -285,7 +282,8 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
PrintAMBEData (opts, state, ambe_d);
}
}
//if using ???
//if using ??? dPMR? D-STAR? X2-TDMA?
if (opts->dmr_stereo == 0)
{
mbe_processAmbe3600x2450Framef (state->audio_out_temp_buf, &state->errs, &state->errs2, state->err_str, ambe_fr, ambe_d, state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality);
@@ -302,32 +300,64 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
}
state->debug_audio_errors += state->errs2;
state->debug_audio_errorsR += state->errs2R;
//having these values here I think caused muddy audio, seems cleaner now when moved to correct area
// state->debug_audio_errors += state->errs2;
// state->debug_audio_errorsR += state->errs2R;
//quick enc check to determine whether or not to play enc traffic
int enc_bit = 0;
//end enc check
if (opts->dmr_stereo == 1 && state->currentslot == 0)
{
processAudio (opts, state);
if (opts->audio_out == 1)
enc_bit = (state->dmr_so >> 6) & 0x1;
if (enc_bit == 1)
{
playSynthesizedVoice (opts, state);
state->dmr_encL = 1;
}
else state->dmr_encL = 0;
if (state->dmr_encL == 0 || opts->dmr_mute_encL == 0)
{
state->debug_audio_errors += state->errs2;
processAudio (opts, state);
if (opts->audio_out == 1)
{
playSynthesizedVoice (opts, state);
}
}
}
if (opts->dmr_stereo == 1 && state->currentslot == 1)
{
processAudioR (opts, state);
if (opts->audio_out == 1)
enc_bit = (state->dmr_soR >> 6) & 0x1;
if (enc_bit == 0x1)
{
playSynthesizedVoiceR (opts, state);
state->dmr_encR = 1;
}
else state->dmr_encR = 0;
if (state->dmr_encR == 0 || opts->dmr_mute_encR == 0)
{
state->debug_audio_errorsR += state->errs2R;
processAudioR (opts, state);
if (opts->audio_out == 1)
{
playSynthesizedVoiceR (opts, state);
}
}
}
//if using ??? dPMR? D-STAR? X2-TDMA?
if (opts->dmr_stereo == 0)
{
state->debug_audio_errors += state->errs2;
processAudio (opts, state);
if (opts->audio_out == 1)
{
playSynthesizedVoice (opts, state);
}
}
//if using ??? dPMR? D-STAR? X2-TDMA?
if (opts->wav_out_f != NULL && opts->dmr_stereo == 0)
{
writeSynthesizedVoice (opts, state);
@@ -336,14 +366,21 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
//per call can only be used when ncurses terminal is active since we use its call history matrix for when to record
if (opts->use_ncurses_terminal == 1 && opts->dmr_stereo_wav == 1 && opts->dmr_stereo == 1 && state->currentslot == 0)
{
//write wav to per call on left channel Slot 1
writeSynthesizedVoice (opts, state);
}
if (state->dmr_encL == 0 || opts->dmr_mute_encL == 0)
{
//write wav to per call on left channel Slot 1
writeSynthesizedVoice (opts, state);
}
}
//per call can only be used when ncurses terminal is active since we use its call history matrix for when to record
if (opts->use_ncurses_terminal == 1 && opts->dmr_stereo_wav == 1 && opts->dmr_stereo == 1 && state->currentslot == 1)
{
//write wav to per call on right channel Slot 2
writeSynthesizedVoiceR (opts, state);
if (state->dmr_encR == 0 || opts->dmr_mute_encR == 0)
{
//write wav to per call on right channel Slot 2
writeSynthesizedVoiceR (opts, state);
}
}

View File

@@ -176,7 +176,7 @@ char *choicesc[] = {
"Return",
"Save Decoded Audio WAV (NO DMR STEREO!)",
"Save Signal to Symbol Capture Bin",
"Toggle Muting ENC P25 Traffic ",
"Toggle Muting Enrypted Traffic ",
"Per Call WAV REC (DMR Stereo/MS)",
"Setup and Start RTL Input ",
"Pulse Audio 48kHz Output",
@@ -451,6 +451,19 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
opts->unmute_encrypted_p25 = 1;
}
else opts->unmute_encrypted_p25 = 0;
if (opts->dmr_mute_encL == 0)
{
opts->dmr_mute_encL = 1;
}
else opts->dmr_mute_encL = 0;
if (opts->dmr_mute_encR == 0)
{
opts->dmr_mute_encR = 1;
}
else opts->dmr_mute_encR = 0;
}
if (choicec == 5)
{
@@ -806,10 +819,17 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
refresh();
wscanw(entry_win, "%d", &state->K);
noecho();
opts->dmr_mute_encL = 0;
opts->dmr_mute_encR = 0;
if (state->K > 255)
{
state->K = 255;
}
if (state->K == 0)
{
opts->dmr_mute_encL = 1;
opts->dmr_mute_encR = 1;
}
break;
}