Comment 4 for bug 703585

Revision history for this message
Owen Williams (ywwg) wrote :

This patch has kind of grown!

Now along with slip mode and rolling loops, I've added a crossfade for loops and seeks. What this means is that over the period of one buffer, I crossfade from the out point of the loop to the in point of the loop, and from the out point of a seek to the in point of the next seek. This is done without adding additional samples to the playback so there's no overlap.

The two crossfades are implemented differently because loops are handled in RAMAN and seeks are in Engine Buffer.

In RAMAN, I do this:
* If I detect a loop-out point, read the whole buffersize, not just the segment up until the loop-out point
* record the number of samples from current position to loop-out point ("preloop samples")
* At the same time, read another segment of samples, this one starting at the loop-in point minus the number of preloop samples.
* Crossfade between these segments

In Enginebuffer I do this:
* When we get a seek, read one extra buffer before the seek is performed
* After a seek, crossfade from that buffer to the current buffer (which is at the new position)

I've checked my work with graphs and charts and it also sounds good to my ears. This is only one buffersize of crossfade (in my case, 2048 samples @96Khz), but even a very low number of samples at very low latencies should be enough to soften the worst pops.

Also I now correctly hint the reader so that as slip mode is enabled, we're caching the samples at the virtual slip playposition. That way when slip is disabled, there's no cache miss when the seek occurs.