Fixed weird audio glitch on some AM station

This commit is contained in:
Ryzerth
2021-05-09 03:06:57 +02:00
parent 1b27916c24
commit 0b276bed1d
4 changed files with 24 additions and 96 deletions

View File

@ -199,6 +199,13 @@ private:
int count = _this->stereoPacker.out.read();
if (count < 0) { return 0; }
if (nBufferFrames != count) { spdlog::warn("Buffer size missmatch, wanted {0}, was asked for {1}", count, nBufferFrames); }
for (int i = 0; i < count; i++) {
if (_this->stereoPacker.out.readBuf[i].l == NAN || _this->stereoPacker.out.readBuf[i].r == NAN) { spdlog::error("NAN in audio data"); }
if (_this->stereoPacker.out.readBuf[i].l == INFINITY || _this->stereoPacker.out.readBuf[i].r == INFINITY) { spdlog::error("INFINITY in audio data"); }
if (_this->stereoPacker.out.readBuf[i].l == -INFINITY || _this->stereoPacker.out.readBuf[i].r == -INFINITY) { spdlog::error("-INFINITY in audio data"); }
}
memcpy(outputBuffer, _this->stereoPacker.out.readBuf, nBufferFrames * sizeof(dsp::stereo_t));
_this->stereoPacker.out.flush();
return 0;