From dee32d6f7f2ea70f9c67b9f1557eaa2f56fb9dc9 Mon Sep 17 00:00:00 2001 From: Jonas Suhr Christensen Date: Sat, 11 Apr 2015 17:01:19 +0200 Subject: Setting local cache in open call. --- src/cachemanager.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cachemanager.cc b/src/cachemanager.cc index f7fc730..9536cdf 100644 --- a/src/cachemanager.cc +++ b/src/cachemanager.cc @@ -61,7 +61,10 @@ void CacheManager::init(size_t poolsize) for(size_t i = 0; i < poolsize; i++) { localcachepos[i] = 0; } - + + for(size_t i = 0; i < poolsize; i++) { + localcache[i] = NULL; + } localcache.resize(poolsize); running = true; @@ -109,6 +112,9 @@ sample_t *CacheManager::open(AudioFile *file, size_t initial_samples_needed, int id2cache[id] = c; } + localcachepos[id] = 0; + localcache[id] = c.front; + if(initial_samples_needed < file->size) { event_t e = createLoadNextEvent(id, c.pos, LOADNEXT); pushEvent(e); @@ -159,6 +165,7 @@ sample_t *CacheManager::next(cacheid_t id, size_t &size) } localcachepos[id] = 0; + localcache[id] = NULL; const cache_t c = getNextCache(id); -- cgit v1.2.3