switched all streams to double buffering

This commit is contained in:
Ryzerth
2020-12-25 16:58:07 +01:00
parent 450896b122
commit 42bc2d01f7
17 changed files with 158 additions and 171 deletions

View File

@ -218,12 +218,11 @@ private:
while (true) {
// Read samples here
_this->client.receiveData(inBuf, blockSize * 2);
if (_this->stream.aquire() < 0) { break; }
for (int i = 0; i < blockSize; i++) {
_this->stream.data[i].q = ((double)inBuf[i * 2] - 128.0) / 128.0;
_this->stream.data[i].i = ((double)inBuf[(i * 2) + 1] - 128.0) / 128.0;
_this->stream.writeBuf[i].q = ((double)inBuf[i * 2] - 128.0) / 128.0;
_this->stream.writeBuf[i].i = ((double)inBuf[(i * 2) + 1] - 128.0) / 128.0;
}
_this->stream.write(blockSize);
if (!_this->stream.swap(blockSize)) { break; };
}
delete[] inBuf;