Update audiohandler.cpp

merge-requests/9/merge
Phil Taylor 2022-04-11 12:04:40 +01:00
rodzic 2b588ffce0
commit b7dee4f5f4
1 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -409,7 +409,7 @@ void audioHandler::getNextAudioChunk()
{
tempBuf.data.append(audioDevice->readAll());
if (tempBuf.data.length() < format.bytesForDuration(setup.blockSize * 1000)) {
if (tempBuf.data.length() < format.bytesForDuration(setup.blockSize * 1000)*format.channelCount()) {
return;
}
@ -417,9 +417,9 @@ void audioHandler::getNextAudioChunk()
livePacket.time= QTime::currentTime();
livePacket.sent = 0;
memcpy(&livePacket.guid, setup.guid, GUIDLEN);
while (tempBuf.data.length() > format.bytesForDuration(setup.blockSize * 1000)) {
livePacket.data = tempBuf.data.mid(0, format.bytesForDuration(setup.blockSize * 1000));
tempBuf.data.remove(0, format.bytesForDuration(setup.blockSize * 1000));
while (tempBuf.data.length() > format.bytesForDuration(setup.blockSize * 1000)*format.channelCount()) {
livePacket.data = tempBuf.data.mid(0, format.bytesForDuration(setup.blockSize * 1000)*format.channelCount());
tempBuf.data.remove(0, format.bytesForDuration(setup.blockSize * 1000)*format.channelCount());
if (livePacket.data.length() > 0)
{
Eigen::VectorXf samplesF;