diff --git a/src/dsd_mbe.c b/src/dsd_mbe.c index 8db97b8..a28a3f9 100644 --- a/src/dsd_mbe.c +++ b/src/dsd_mbe.c @@ -283,7 +283,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a } } - //if using ??? dPMR? D-STAR? X2-TDMA? + //if using anything but DMR Stereo, borrowing state->dmr_encL to signal enc or clear for other types 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); @@ -291,7 +291,8 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a { PrintAMBEData (opts, state, ambe_d); } - if (opts->mbe_out_f != NULL) + //only save MBE files if not enc or unmuted, THIS does not seem to work for some reason + if (opts->mbe_out_f != NULL && (opts->unmute_encrypted_p25 == 1 || state->dmr_encL == 0) ) { saveAmbe2450Data (opts, state, ambe_d); } @@ -346,8 +347,8 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a } } - //if using ??? dPMR? D-STAR? X2-TDMA? - if (opts->dmr_stereo == 0) + //if using anything but DMR Stereo, borrowing state->dmr_encL to signal enc or clear for other types + if (opts->dmr_stereo == 0 && (opts->unmute_encrypted_p25 == 1 || state->dmr_encL == 0) ) { state->debug_audio_errors += state->errs2; processAudio (opts, state); @@ -357,8 +358,8 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a } } - //if using ??? dPMR? D-STAR? X2-TDMA? - if (opts->wav_out_f != NULL && opts->dmr_stereo == 0) + //if using anything but DMR Stereo, borrowing state->dmr_encL to signal enc or clear for other types + if (opts->wav_out_f != NULL && opts->dmr_stereo == 0 && (opts->unmute_encrypted_p25 == 1 || state->dmr_encL == 0)) { writeSynthesizedVoice (opts, state); } diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index b88c77d..d980ddb 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -1294,7 +1294,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) rdR = state->lastsrcR; } //move to seperate P25 version plz - opts->p25enc = 0; + //opts->p25enc = 0; } //DMR TG @@ -1311,7 +1311,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) tgR = state->lasttgR; } - opts->p25enc = 0; + //opts->p25enc = 0; } diff --git a/src/dsd_reset.c b/src/dsd_reset.c index a1d9bfd..c34f4a2 100644 --- a/src/dsd_reset.c +++ b/src/dsd_reset.c @@ -95,6 +95,10 @@ resetState (dsd_state * state) state->debug_header_critical_errors = 0; state->nxdn_last_ran = 0; + // state->payload_algid = 0; + // state->payload_algidR = 0; + state->dmr_encL = 0; + state->dmr_encR = 0; //each time you run this, it increses memory use by 4MB, massive memory leak //need to revisit this sometime and look into only resetting only the necesary items to let P25 switch between signals (C4FM or Wide) without needing a restart diff --git a/src/nxdn_lib.c b/src/nxdn_lib.c index e892caa..5b3fea1 100644 --- a/src/nxdn_lib.c +++ b/src/nxdn_lib.c @@ -786,10 +786,19 @@ void NXDN_decode_VCALL(dsd_opts * opts, dsd_state * state, uint8_t * Message) state->nxdn_last_rid = SourceUnitID & 0xFFFF; //only grab if CRC is okay state->nxdn_last_tg = (DestinationID & 0xFFFF); state->nxdn_key = (KeyID & 0xFF); - state->nxdn_cipher_type = CipherType; + state->nxdn_cipher_type = CipherType; //will this set to zero if no enc? } //fprintf(stderr, "(CRC OK) "); } + //set enc bit here so we can tell playSynthesizedVoice whether or not to play enc traffic + if (state->nxdn_cipher_type != 0) + { + state->dmr_encL = 1; + } + if (state->nxdn_cipher_type == 0) + { + state->dmr_encL = 0; + } //fprintf(stderr, " (OK) - "); else { diff --git a/src/p25p1_ldu.c b/src/p25p1_ldu.c index 4c83b38..6e2cecd 100644 --- a/src/p25p1_ldu.c +++ b/src/p25p1_ldu.c @@ -119,8 +119,17 @@ process_IMBE (dsd_opts* opts, dsd_state* state, int* status_count) #ifdef TRACE_DSD state->debug_prefix = '\0'; #endif + //check for enc, then always run below step and mute at the point of playing audio so we can still dump the frames + if (state->payload_algid != 0x80) + { + state->dmr_encL = 1; + } + if (state->payload_algid == 0x80) + { + state->dmr_encL = 0; + } - if (state->p25kid == 0 || opts->unmute_encrypted_p25 == 1) + if (1 == 1) //state->p25kid == 0 || opts->unmute_encrypted_p25 == 1 { { // Check for a non-standard c0 transmitted