Add dynamic TG voice prompts and status TG.

This commit is contained in:
Jonathan Naylor
2020-04-03 16:54:35 +01:00
parent 9771b1ff0c
commit 0fef073c13
16 changed files with 651 additions and 151 deletions

View File

@@ -41,7 +41,7 @@ m_ambeFile(),
m_slot(slot),
m_lc(FLCO_GROUP, id, tg),
m_embeddedLC(),
m_status(VS_NONE),
m_status(XLXVS_NONE),
m_timer(1000U, 1U),
m_stopWatch(),
m_seqNo(0U),
@@ -68,7 +68,7 @@ CXLXVoice::~CXLXVoice()
for (std::vector<CDMRData*>::iterator it = m_data.begin(); it != m_data.end(); ++it)
delete *it;
for (std::unordered_map<std::string, CPositions*>::iterator it = m_positions.begin(); it != m_positions.end(); ++it)
for (std::unordered_map<std::string, CXLXPositions*>::iterator it = m_positions.begin(); it != m_positions.end(); ++it)
delete it->second;
m_data.clear();
@@ -115,7 +115,7 @@ bool CXLXVoice::open()
unsigned int start = ::atoi(p2) * AMBE_LENGTH;
unsigned int length = ::atoi(p3) * AMBE_LENGTH;
CPositions* pos = new CPositions;
CXLXPositions* pos = new CXLXPositions;
pos->m_start = start;
pos->m_length = length;
@@ -171,7 +171,7 @@ void CXLXVoice::createVoice(const std::vector<std::string>& words)
unsigned int ambeLength = 0U;
for (std::vector<std::string>::const_iterator it = words.begin(); it != words.end(); ++it) {
if (m_positions.count(*it) > 0U) {
CPositions* position = m_positions.at(*it);
CXLXPositions* position = m_positions.at(*it);
ambeLength += position->m_length;
} else {
LogWarning("Unable to find character/phrase \"%s\" in the index", (*it).c_str());
@@ -199,7 +199,7 @@ void CXLXVoice::createVoice(const std::vector<std::string>& words)
unsigned int pos = SILENCE_LENGTH * AMBE_LENGTH;
for (std::vector<std::string>::const_iterator it = words.begin(); it != words.end(); ++it) {
if (m_positions.count(*it) > 0U) {
CPositions* position = m_positions.at(*it);
CXLXPositions* position = m_positions.at(*it);
unsigned int start = position->m_start;
unsigned int length = position->m_length;
::memcpy(ambeData + pos, m_ambe + start, length);
@@ -269,13 +269,13 @@ void CXLXVoice::createVoice(const std::vector<std::string>& words)
delete[] ambeData;
m_status = VS_WAITING;
m_status = XLXVS_WAITING;
m_timer.start();
}
bool CXLXVoice::read(CDMRData& data)
{
if (m_status != VS_SENDING)
if (m_status != XLXVS_SENDING)
return false;
unsigned int count = m_stopWatch.elapsed() / DMR_SLOT_TIME;
@@ -291,7 +291,7 @@ bool CXLXVoice::read(CDMRData& data)
delete *it;
m_data.clear();
m_timer.stop();
m_status = VS_NONE;
m_status = XLXVS_NONE;
}
return true;
@@ -304,9 +304,9 @@ void CXLXVoice::clock(unsigned int ms)
{
m_timer.clock(ms);
if (m_timer.isRunning() && m_timer.hasExpired()) {
if (m_status == VS_WAITING) {
if (m_status == XLXVS_WAITING) {
m_stopWatch.start();
m_status = VS_SENDING;
m_status = XLXVS_SENDING;
m_it = m_data.begin();
m_sent = 0U;
}