diff options
author | Jonas Suhr Christensen <jsc@umbraculum.org> | 2015-04-11 17:01:19 +0200 |
---|---|---|
committer | Jonas Suhr Christensen <jsc@umbraculum.org> | 2015-04-11 17:01:19 +0200 |
commit | be990c6057033c298dd7d69dbf52872833534b85 (patch) | |
tree | 540f391a8ec723c22b168ba4c114043cfe7d3b44 /src/cachemanager.cc | |
parent | 9c03659b323eb27ca447f7448512aa0e6c03e025 (diff) |
Setting local cache in open call.
Diffstat (limited to 'src/cachemanager.cc')
-rw-r--r-- | src/cachemanager.cc | 9 |
1 files changed, 8 insertions, 1 deletions
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); |