Bug Fix: Rubber Band handles end of track gap

The code was polling the input chunk duration after emptying out the
chunk's samples, which resulted in an input duration account sitting at
exactly zero, so the end overrun flush would not be cut short properly,
resulting in gaps between tracks.

Correct the input sum to tabulate before emptying the input chunk, so
output remains properly gapless.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2025-02-16 14:03:16 -08:00
parent dd5be9b117
commit f251c91f02

View file

@ -439,6 +439,8 @@ static void * kDSPRubberbandNodeContext = &kDSPRubberbandNodeContext;
streamTimeRatio = [chunk streamTimeRatio];
isHDCD = [chunk isHDCD];
stretchIn += [chunk duration] / tempo;
size_t frameCount = [chunk frameCount];
NSData *sampleData = [chunk removeSamples:frameCount];
@ -446,8 +448,6 @@ static void * kDSPRubberbandNodeContext = &kDSPRubberbandNodeContext;
cblas_scopy((int)frameCount, ((const float *)[sampleData bytes]) + i, channels, rsPtrs[i], 1);
}
stretchIn += [chunk duration] / tempo;
endOfStream = [[previousNode buffer] isEmpty] && [previousNode endOfStream] == YES;
int len = (int)frameCount;