From 1137dade95adc73c494e748f56b2dc0ffd978ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Fri, 29 Jan 2016 13:18:33 +0100 Subject: wip 3 --- src/audiocache.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/audiocache.cc b/src/audiocache.cc index 2ca0616..7856f4a 100644 --- a/src/audiocache.cc +++ b/src/audiocache.cc @@ -28,7 +28,6 @@ #include -#include #include #include @@ -105,7 +104,15 @@ sample_t* AudioCache::open(const AudioFile& file, size_t initial_samples_needed, } else { - // cropped_size is the preload chunk size cropped to sample length. + // Make sure that the preload-data made available to the next() calls + // fit on frame boundary: + // + // [ all preloaded data ] + // [ initial ][ biggest multiple of full frames ][ the rest ] + // \ / + // \----------------------v-------------------/ + // cropped_size + cropped_size = file.preloadedsize - c.localpos; cropped_size -= cropped_size % framesize; cropped_size += initial_samples_needed; -- cgit v1.2.3