summaryrefslogtreecommitdiff
path: root/src/drumkitloader.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-05-22 10:34:21 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2016-01-20 13:28:48 +0100
commit60cd3f9dc45b194198198591a7bf48e2d8afb16c (patch)
tree1f32bc03dbd42da23f5c4707f8aa9d51f1193eb3 /src/drumkitloader.cc
parentfd501c7dc4042ce993b16a2d079d5b05af2ecb07 (diff)
Added framesize control mechanism to the engine, and made us of it in the cachemanager and drumkitloader.
Diffstat (limited to 'src/drumkitloader.cc')
-rw-r--r--src/drumkitloader.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc
index 2b66ae0..413d3f4 100644
--- a/src/drumkitloader.cc
+++ b/src/drumkitloader.cc
@@ -34,6 +34,7 @@
DrumKitLoader::DrumKitLoader()
: semaphore("drumkitloader")
+ , framesize(0)
{
run();
run_semaphore.wait(); // Wait for the thread to actually start.
@@ -64,6 +65,13 @@ void DrumKitLoader::skip()
load_queue.clear();
}
+void DrumKitLoader::setFrameSize(size_t framesize)
+{
+ MutexAutolock l(mutex);
+ this->framesize = framesize;
+ framesize_semaphore.post(); // Signal that the framesize has been set.
+}
+
bool DrumKitLoader::isDone()
{
MutexAutolock l(mutex);
@@ -120,6 +128,8 @@ void DrumKitLoader::thread_main()
run_semaphore.post(); // Signal that the thread has been started.
+ framesize_semaphore.wait(); // Wait until the framesize has been set.
+
while(running) {
size_t size;
{
@@ -137,7 +147,7 @@ void DrumKitLoader::thread_main()
AudioFile *audiofile = load_queue.front();
load_queue.pop_front();
filename = audiofile->filename;
- audiofile->load(PRELOADSIZE);
+ audiofile->load(framesize * CHUNK_MULTIPLIER + framesize);
}
loaded++;