diff --git a/NXDNGateway/Voice.cpp b/NXDNGateway/Voice.cpp index 5bad6d6..dd66996 100644 --- a/NXDNGateway/Voice.cpp +++ b/NXDNGateway/Voice.cpp @@ -189,8 +189,9 @@ void CVoice::createVoice(unsigned int tg, const std::vector& words) unsigned char* ambeData = new unsigned char[ambeLength]; // Fill the AMBE data with silence - for (unsigned int i = 0U; i < ambeLength; i += AMBE_LENGTH) - ::memcpy(ambeData + i, SILENCE, AMBE_LENGTH); + unsigned int offset = 0U; + for (unsigned int i = 0U; i < (ambeLength / AMBE_LENGTH); i++, offset += AMBE_LENGTH) + ::memcpy(ambeData + offset, SILENCE, AMBE_LENGTH); // Put offset in for silence at the beginning unsigned int pos = SILENCE_LENGTH * AMBE_LENGTH; @@ -259,12 +260,12 @@ void CVoice::createVoice(unsigned int tg, const std::vector& words) m_timer.start(); } -bool CVoice::read(unsigned char* data) +unsigned int CVoice::read(unsigned char* data) { assert(data != NULL); if (m_status != VS_SENDING) - return false; + return 0U; unsigned int count = m_stopWatch.elapsed() / NXDN_FRAME_TIME; @@ -281,10 +282,10 @@ bool CVoice::read(unsigned char* data) m_status = VS_NONE; } - return true; + return NXDN_FRAME_LENGTH; } - return false; + return 0U; } void CVoice::abort() diff --git a/NXDNGateway/Voice.h b/NXDNGateway/Voice.h index a811406..6515014 100644 --- a/NXDNGateway/Voice.h +++ b/NXDNGateway/Voice.h @@ -47,7 +47,7 @@ public: void linkedTo(unsigned int tg); void unlinked(); - bool read(unsigned char* data); + unsigned int read(unsigned char* data); void abort();