make silence chunks useful/correct

This commit is contained in:
BotoX 2021-05-19 23:46:12 +02:00
parent 89f28d5090
commit 2d8000b023
2 changed files with 4 additions and 2 deletions

View File

@ -190,14 +190,15 @@ void VoiceDataWriter::EndCommandPacket(const PacketTrailingBits& trailingBits)
if(!m_isSilenced)
{
m_isSilenced = true;
m_silence.emplace_back(std::make_pair(m_curTick, 0));
m_silenceTicksStart = m_silenceTicks;
m_silence.emplace_back(std::make_pair(m_curTick - m_silenceTicks, 0));
}
m_silenceTicks += (m_curTick - m_lastTick);
}
else if(m_isSilenced)
{
m_isSilenced = false;
m_silence.back().second = m_curTick;
m_silence.back().second = m_silenceTicks - m_silenceTicksStart;
}
for(auto& state : m_playerVoiceStates)

View File

@ -86,6 +86,7 @@ private:
int32_t m_lastVoiceTick = 0;
int32_t m_silenceTicks = 0;
int32_t m_silenceTicksStart = 0;
const char* m_outputPath = nullptr;
int16_t m_decodeBuffer[32768];