Resampler: Fix gapless output
The resampler wasn't being given enough room to flush its final output, so a function was added to determine the current output latency, and more sample data is requested, allowing the full output flush to occur. Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
6dccaa4d7f
commit
5622e92899
|
@ -754,6 +754,9 @@ tryagain:
|
|||
size_t outputDone = 0;
|
||||
|
||||
if(!skipResampler) {
|
||||
// This is needed at least for the flush, or else there won't be room for it
|
||||
ioNumberPackets += ((r8bstate *)_r8bstate)->latency();
|
||||
|
||||
#ifdef _DEBUG
|
||||
[BadSampleCleaner cleanSamples:(float *)(((uint8_t *)inputBuffer) + inpOffset)
|
||||
amount:inputSamples * floatFormat.mChannelsPerFrame
|
||||
|
|
|
@ -43,6 +43,10 @@ struct r8bstate {
|
|||
delete[] Resamps;
|
||||
}
|
||||
|
||||
double latency() {
|
||||
return ((double)inProcessed * sampleRatio) - (double)outProcessed;
|
||||
}
|
||||
|
||||
int resample(const float *input, size_t inCount, size_t *inDone, float *output, size_t outMax) {
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
|
Loading…
Reference in New Issue