From be83681d67fb5407181240bff816ff202818b808 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 10 Apr 2015 16:37:32 +0200 Subject: Add preliminary functionality of next method. --- src/cachemanager.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/cachemanager.cc b/src/cachemanager.cc index 5e2adf0..25bbae5 100644 --- a/src/cachemanager.cc +++ b/src/cachemanager.cc @@ -52,7 +52,7 @@ void CacheManager::init(int poolsize) sample_t *CacheManager::open(AudioFile *file, int initial_samples_needed, int channel, cacheid_t &id) { // What if no free ids is available? - m_ids.lock(); + m_ids.lock(); id = availableids.front(); availableids.pop_front(); m_ids.unlock(); @@ -87,8 +87,15 @@ void CacheManager::close(cacheid_t id) sample_t *CacheManager::next(cacheid_t id, size_t &size) { - sample_t *s = NULL; - return s; + cache_t *c; + { + MutexAutolock l(m_caches); + c = &id2cache[id]; + } + size = 256; + sample_t *s = c->file->data + c->pos; + c->pos += size; + return s; } void CacheManager::loadNext(cacheid_t id) -- cgit v1.2.3