diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-04-10 16:37:32 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-04-10 16:37:32 +0200 |
commit | be83681d67fb5407181240bff816ff202818b808 (patch) | |
tree | e4fa921b706f564e91fb18eee51d9c6f30606f3a /src | |
parent | 96df5c64a03de57732eb61c3f65c4e17d14c6688 (diff) |
Add preliminary functionality of next method.
Diffstat (limited to 'src')
-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) |