sox resampler: Perform post file flush

Flush the resampler when the source file terminates, so that it outputs
delayed samples properly. This fixes gapless decoding of resampled
files.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
CQTexperiment
Christopher Snowhill 2022-02-01 22:47:11 -08:00
parent 587be93f21
commit 074e4115dd
1 changed files with 15 additions and 0 deletions

View File

@ -954,7 +954,22 @@ tryagain:
if (!skipResampler)
{
ioNumberPackets += soxr_delay(soxr);
soxr_process(soxr, (float *)(((uint8_t*)inputBuffer) + inpOffset), inputSamples, &inputDone, floatBuffer, ioNumberPackets, &outputDone);
if (latencyEatenPost)
{
// Post file flush
size_t idone = 0, odone = 0;
do
{
soxr_process(soxr, NULL, 0, &idone, floatBuffer + outputDone * floatFormat.mBytesPerPacket, ioNumberPackets - outputDone, &odone);
outputDone += odone;
}
while (odone > 0);
}
}
else
{