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
parent
587be93f21
commit
074e4115dd
|
@ -954,7 +954,22 @@ tryagain:
|
||||||
|
|
||||||
if (!skipResampler)
|
if (!skipResampler)
|
||||||
{
|
{
|
||||||
|
ioNumberPackets += soxr_delay(soxr);
|
||||||
|
|
||||||
soxr_process(soxr, (float *)(((uint8_t*)inputBuffer) + inpOffset), inputSamples, &inputDone, floatBuffer, ioNumberPackets, &outputDone);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue