diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-01-19 08:32:44 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-01-19 08:32:44 +0100 |
commit | 22b99e7d0379d1b347ea04c27e46b83ed40d057b (patch) | |
tree | 3b0daf93a9f953cf0b9c9e6ad05dff762b02315b /src/drumgizmo.cc | |
parent | 2a9dda465230b3b129dc942095a7c8a99ef5fa50 (diff) |
Split CacheManager into several AudioCache classes and refactored the lot of them. Unit tests added.
Diffstat (limited to 'src/drumgizmo.cc')
-rw-r--r-- | src/drumgizmo.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index 5348324..00e93d1 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -54,12 +54,12 @@ DrumGizmo::DrumGizmo(AudioOutputEngine *o, AudioInputEngine *i) , freewheel(false) { is_stopping = false; - cacheManager.init(1000, true); // start thread + audioCache.init(1000); // start thread } DrumGizmo::~DrumGizmo() { - cacheManager.deinit(); // stop thread + audioCache.deinit(); // stop thread } bool DrumGizmo::loadkit(std::string file) @@ -185,8 +185,8 @@ void DrumGizmo::setFrameSize(size_t framesize) // Update framesize in drumkitloader and cachemanager: loader.setFrameSize(framesize); printf("loader.setFrameSize\n"); fflush(stdout); - cacheManager.setFrameSize(framesize); - printf("cacheManager.setFrameSize\n"); fflush(stdout); + audioCache.setFrameSize(framesize); + printf("audioCache.setFrameSize\n"); fflush(stdout); } } @@ -196,7 +196,7 @@ void DrumGizmo::setFreeWheel(bool freewheel) // than realtime. if(freewheel != this->freewheel) { this->freewheel = freewheel; - cacheManager.setAsyncMode(!freewheel); + audioCache.setAsyncMode(!freewheel); } } @@ -424,7 +424,7 @@ void DrumGizmo::getSamples(int ch, int pos, sample_t *s, size_t sz) if(evt->cache_id == CACHE_NOID) { size_t initial_chunksize = (pos + sz) - evt->offset; - evt->buffer = cacheManager.open(af, initial_chunksize, + evt->buffer = audioCache.open(af, initial_chunksize, af->filechannel, evt->cache_id); evt->buffer_size = initial_chunksize; } @@ -484,13 +484,13 @@ void DrumGizmo::getSamples(int ch, int pos, sample_t *s, size_t sz) evt->t += evt->buffer_size; // Add internal buffer counter to "global" event counter. if((evt->t < af->size) && (evt->rampdown != 0)) { - evt->buffer = cacheManager.next(evt->cache_id, evt->buffer_size); + evt->buffer = audioCache.next(evt->cache_id, evt->buffer_size); } else { removeevent = true; } if(removeevent) { - cacheManager.close(evt->cache_id); + audioCache.close(evt->cache_id); } } } |