diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-04-10 16:37:32 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-01-20 13:22:07 +0100 |
commit | 5b16868acebd1296861062eed0e1e018b2b5a3bf (patch) | |
tree | 8eb195a33d1e236138327d865106b8bbb918d94b | |
parent | 99db25aae3c8f06b9bb1a17865e344cfe559b47e (diff) |
Add preliminary functionality of next method.
-rw-r--r-- | src/cachemanager.cc | 13 |
1 files changed, 10 insertions, 3 deletions
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) |