diff --git a/DMRDefines.h b/DMRDefines.h index e9f297e..d993336 100644 --- a/DMRDefines.h +++ b/DMRDefines.h @@ -59,6 +59,12 @@ const unsigned char DMR_IDLE_DATA[] = {TAG_DATA, 0x00U, 0x36U, 0x00U, 0x0DU, 0xFFU, 0x57U, 0xD7U, 0x5DU, 0xF5U, 0xD0U, 0x03U, 0xF6U, 0xE4U, 0x65U, 0x17U, 0x1BU, 0x48U, 0xCAU, 0x6DU, 0x4FU, 0xC6U, 0x10U, 0xB4U}; +// A silence frame with no EMB and a null Short LC +const unsigned char DMR_SILENCE_DATA[] = { TAG_DATA, 0x00U, + 0x88U, 0xC8U, 0xA3U, 0x54U, 0x22U, 0x16U, 0x31U, 0x69U, 0x6AU, 0xAAU, 0xCAU, + 0x81U, 0x54U, 0x20U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x01U, 0x27U, 0x13U, + 0x29U, 0x48U, 0xAAU, 0xCAU, 0x81U, 0x54U, 0x21U, 0x27U, 0x31U, 0x39U, 0x6AU }; + const unsigned char PAYLOAD_LEFT_MASK[] = {0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xF0U}; const unsigned char PAYLOAD_RIGHT_MASK[] = {0x0FU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU}; @@ -84,8 +90,8 @@ const unsigned char DT_IDLE = 0x09U; const unsigned char DT_RATE_1_DATA = 0x0AU; // Dummy values -const unsigned char DT_VOICE_SYNC = 0xF0U; -const unsigned char DT_VOICE = 0xF1U; +const unsigned char DT_VOICE_SYNC = 0xF0U; +const unsigned char DT_VOICE = 0xF1U; const unsigned char DMR_IDLE_RX = 0x80U; const unsigned char DMR_SYNC_DATA = 0x40U; diff --git a/DMRSlot.cpp b/DMRSlot.cpp index bb96ddc..bad8ab5 100644 --- a/DMRSlot.cpp +++ b/DMRSlot.cpp @@ -1051,12 +1051,20 @@ void CDMRSlot::insertSilence(const unsigned char* data, unsigned char seqNo) void CDMRSlot::insertSilence(unsigned int count) { + unsigned char data[DMR_FRAME_LENGTH_BYTES + 2U]; + + ::memcpy(data, m_lastFrame, 2U); // The control data + ::memcpy(data + 2U, m_lastFrame + 24U + 2U, 9U); // Copy the last audio block to the first + ::memcpy(data + 24U + 2U, data + 2U, 9U); // Copy the last audio block to the last + ::memcpy(data + 9U + 2U, data + 2U, 5U); // Copy the last audio block to the middle (1/2) + ::memcpy(data + 19U + 2U, data + 4U + 2U, 5U); // Copy the last audio block to the middle (2/2) + unsigned char n = (m_n + 1U) % 6U; unsigned char seqNo = m_seqNo + 1U; for (unsigned int i = 0U; i < count; i++) { - unsigned char data[DMR_FRAME_LENGTH_BYTES + 2U]; - ::memcpy(data, m_lastFrame, DMR_FRAME_LENGTH_BYTES + 2U); + if (i > 0U) + ::memcpy(data, DMR_SILENCE_DATA, DMR_FRAME_LENGTH_BYTES + 2U); if (n == 0U) { CDMRSync sync; diff --git a/DStarControl.cpp b/DStarControl.cpp index dfc5770..de887e4 100644 --- a/DStarControl.cpp +++ b/DStarControl.cpp @@ -654,7 +654,10 @@ void CDStarControl::insertSilence(unsigned int count) for (unsigned int i = 0U; i < count; i++) { unsigned char data[DSTAR_FRAME_LENGTH_BYTES + 1U]; - ::memcpy(data, m_lastFrame, DSTAR_FRAME_LENGTH_BYTES + 1U); + if (i < 3U) + ::memcpy(data + 1U, m_lastFrame + 1U, DSTAR_FRAME_LENGTH_BYTES); + else + ::memcpy(data + 1U, DSTAR_NULL_AMBE_DATA_BYTES, DSTAR_FRAME_LENGTH_BYTES); if (n == 0U) { // Regenerate the sync diff --git a/Version.h b/Version.h index 98fc387..cdc3d00 100644 --- a/Version.h +++ b/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20160127"; +const char* VERSION = "20160128"; #endif